From: Hannes on 10 May 2010 05:00 Hello, I would like to print letters centered in the figure. I works when I use the GUI, but it does not work via commandline. Since I have to print a few hundred of this figures, I would prefer to not do this manually. Here is an example code: figure('position',[1,1,800, 600], 'unit','pixel'); a = axes('unit','pixel','Position',[0 0 800 600]); [d] = get(a,'xlim'); [e] = get(a,'ylim'); axis off text('String', 'N',... 'Color',[0 1 0],... 'FontName', 'Arial',... 'Position',[d(2)/2 e(2)/2],... 'HorizontalAlignment', 'Center',... 'VerticalAlignment', 'Middle',... 'FontSize',48); print(pic,'-dtiff', '-r600','testN'); saveas(pic,'testN.tiff'); print(gcf,'-depsc2', '-r0','testN') Printing it using the code above does results in a figure displaying the letter moved to the right. If I use the GUI and specify: "ExportSetup" => "size" => "Expand axes to fill figure" and "Rendering" => "resolution" => "screen", "keep axis limits", and then "Apply to Figure", and finally "export" the resulting figure appears like on the screen. In the Help I found as an option supposed to print with screen resolution '-r0', but apparently, it does not work for me. Does anybody know how I can use the above mentioned options from the GUI in the commandline? Thank you very much in advance for help! Hannes
From: Oliver Woodford on 10 May 2010 05:47 "Hannes " wrote: > I would like to print letters centered in the figure. I works when I use the GUI, but it does not work via commandline. Since I have to print a few hundred of this figures, I would prefer to not do this manually. Export_fig (http://www.mathworks.com/matlabcentral/fileexchange/23629-exportfig) is a function that aims to export figures as they appear on screen.
From: Hannes on 10 May 2010 06:42 "Oliver Woodford" <o.j.woodford.98(a)cantab.net> wrote in message <hs8kmp$p1l$1(a)fred.mathworks.com>... > Export_fig (http://www.mathworks.com/matlabcentral/fileexchange/23629-exportfig) is a function that aims to export figures as they appear on screen. Thanks Oliver! I tried it and it seems to work, I have just one more problem: the pictures are saved transparent. The white background color is not saved. Why? Even if I specify the background color. See: pic = figure('position',[1,1,800, 600], 'unit','pixel'); a = axes('unit','pixel','Position',[0 0 800 600]); [d] = get(a,'xlim'); [e] = get(a,'ylim'); set(pic, 'color', 'white'); set(pic, 'InvertHardCopy', 'off'); axis off text('String', 'I',... 'BackgroundColor', 'white',... 'Color',[1 0 0],... 'FontName', 'Arial',... 'Position',[d(2)/2 e(2)/2],... 'HorizontalAlignment', 'Center',... 'VerticalAlignment', 'Middle',... 'FontSize',48); export_fig(pic, 'test', '-tif', '-png', '-bmp','-r90', '-m1') Actually, it appears as if only the letter is saved. Or am I mistaken? Hannes
From: Oliver Woodford on 10 May 2010 09:13 "Hannes " wrote: > It appears as if only the letter is saved. Or am I mistaken? Yes, the backround is cropped by default. You can disable this using the -nocrop option. The background is only transparent if you set the figure color to 'none'.
From: Hannes on 10 May 2010 12:07 "Oliver Woodford" <o.j.woodford.98(a)cantab.net> wrote in message <hs90p1$pet$1(a)fred.mathworks.com>... > "Hannes " wrote: > > It appears as if only the letter is saved. Or am I mistaken? > > Yes, the backround is cropped by default. You can disable this using the -nocrop option. The background is only transparent if you set the figure color to 'none'. THANKS! That is THE solution! You saved my day! Hannes ;-)
|
Pages: 1 Prev: ButtonDownFcn doesn't work if the axis is off Next: watermarking |