Saving images from figure window in Matlab.

1 次查看(过去 30 天)
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.

采纳的回答

Chad Greene
Chad Greene 2017-7-27
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 个评论
Naseeb Gill
Naseeb Gill 2017-7-27
编辑:Naseeb Gill 2017-7-27
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 2017-7-28
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.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Convert Image Type 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by