Saving a 1xn Bar plot as a jpg
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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 comentarios
Respuestas (1)
Ameer Hamza
el 30 de Oct. de 2020
Editada: Ameer Hamza
el 30 de Oct. de 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 comentarios
Ver también
Categorías
Más información sobre Printing and Saving en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!