Saving images from figure window in Matlab.

3 vues (au cours des 30 derniers jours)
Naseeb Gill
Naseeb Gill le 27 Juil 2017
Commenté : Naseeb Gill le 28 Juil 2017
I'm saving images 500 dpi, using rendering in export setup from figure window in Matlab. But there is little change I have to make. I get image like below: I mean there is lot of white space at sides which I want to eliminate. White portion is marked with black sketch in image.
I want to make my image look like this: Whitout any white portion at sides.
How to do this?
Thanks.

Réponse acceptée

Chad Greene
Chad Greene le 27 Juil 2017
I recommend using export_fig, which crops the white space by default. The syntax is simply
export_fig myfig.png -r500
if you want 500 dpi. If you want a tiny bit of white space around the image, say, 1% of the figure width, do
export_fig myfig.png -r500 -p0.01
  2 commentaires
Naseeb Gill
Naseeb Gill le 27 Juil 2017
Modifié(e) : Naseeb Gill le 27 Juil 2017
Thanks @Chad Greene for reply but when I proceed as you suggest I get following error:
Undefined function 'export_fig' for input arguments of type 'char'.
Error in boxplot_graph_draw (line 84)
export_fig myfig.png -r500 -p0.01 ;
The code I'm running is
// values of Rc, Gc etc. I loaded from laptop in workspace in form of //array
X = [Rc;Gc;Bc;Rs;Gs;Bs;Rl;Gl;Bl];
G = [zeros(length(Rc), 1); ones(length(Gc), 1); 2*ones(length(Bc), 1);3*ones(length(Rs), 1);...
4*ones(length(Gs), 1);5*ones(length(Bs), 1);6*ones(length(Rl), 1);7*ones(length(Gl), 1);...
8*ones(length(Bl), 1)];
boxplot(X,G,'Labels',{'Yc','Cbc','Crc','Ys','Cbs','Crs','Yl','Cbl','Crl'});
export_fig myfig.png -r500 -p0.01 ;
I added export_fig folder to maltlab path also.
Naseeb Gill
Naseeb Gill le 28 Juil 2017
Thanks @Chad Greene It works fine. Actually I made mistake in path addition. What I did was, I just select altmany-export_fig-5be2ca4 folder and click on save. But what I need to do is, I should open this folder using pathtool and then click on save.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Convert Image Type 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