Saving a 1xn Bar plot as a jpg
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Hello,
y = [2 2 3; 2 5 6; 2 8 9; 2 11 12];
test = bar(y)

I want to save this bar plot as an image programatically. I have no issues saving a 1x1 Bar using saveas(), but when I have a 1xN Bar then I get this errorr:
Error using checkArgsForHandleToPrint
Can print only one page at a time.
Error in checkArgsForHandleToPrint
Error in print>LocalCreatePrintJob (line 101)
handles = checkArgsForHandleToPrint(0, varargin{:});
Error in print (line 38)
[pj, inputargs] = LocalCreatePrintJob(varargin{:});
Error in saveas (line 181)
print( h, name, ['-d' dev{i}] )
How can I programatically save a 1xN bar plot?
0 Kommentare
Antworten (1)
Ameer Hamza
am 30 Okt. 2020
Bearbeitet: Ameer Hamza
am 30 Okt. 2020
saveas() is quite an old function and not suitable for getting high-quality images. If you are using a recent version of MATLAB, then try exportgraphics()
y = [2 2 3; 2 5 6; 2 8 9; 2 11 12];
bar(y)
exportgraphics(gcf, 'filename.jpg', 'Resolution', 300)
If you are using an older version which does not have exportgraphice() then use this FEX package: https://www.mathworks.com/matlabcentral/fileexchange/23629-export_fig
0 Kommentare
Siehe auch
Kategorien
Mehr zu Printing and Saving finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!