How can I get rid of the large invisible border of my MATLAB figure without cropping it?

144 vues (au cours des 30 derniers jours)
Hey I have a question that would be super helpful to have an answer to. I am generating many MATLAB images. However, each image, when I copy figure to PPT, seems to have a large invisible box around it, which you can see when you click on the image. I know you can easily crop this out, but I don't want to crop many many images, and have to worry if the cropping is the same size. I want to copy these images into a Word document, and all the extra white space is not favorable. Is there a way to get that invisible box to just "hug" the image, instead of extending out several inches?
  3 commentaires
Jaideep Cherakka Kesavan
Jaideep Cherakka Kesavan le 29 Mai 2022
In Matlab 2022a
Step 1: Activate Data Tips in Tools Menu in the Figure window. Move the cursor to the top right corner of the image or picture or signal. Some icons (floppy disc, home, brush etc.) will appear above the image or picture or signal displayed.
Step 2: Click on the last icon in the first column and copy as vector graphic.
Step 3: Paste in Powerpoint or Inkscape. The image will not have extra white space.

Connectez-vous pour commenter.

Réponse acceptée

KSSV
KSSV le 12 Jan 2017
clc; clear all ;
x = rand(20,1) ;
y = rand(20,1) ;
plot(x,y)
set(gca,'LooseInset',get(gca,'TightInset'));
saveas(gcf,'junk.jpg')
You may also look into:
  3 commentaires
Farid
Farid le 29 Mar 2021
May Gods bless you KSSV. Thanks!
ahmad eldeeb
ahmad eldeeb le 21 Déc 2021
This is not working in patch plots. Any solution?

Connectez-vous pour commenter.

Plus de réponses (1)

Gyaneshwar dubacharla
Gyaneshwar dubacharla le 9 Août 2020
Modifié(e) : Adam Danz le 7 Oct 2024
Use this command from MATLAB
exportgraphics(gca,fname,'BackgroundColor','none')
  1 commentaire
Adam Danz
Adam Danz le 7 Oct 2024
Modifié(e) : Adam Danz le 7 Oct 2024
⭐This is the recommended solution to cropping the exported axes or figure. See also copygraphics.

Connectez-vous pour commenter.

Catégories

En savoir plus sur Printing and Saving dans Help Center et File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by