How to save an axes GUI object which of the scales on the left and the right y axis differ?
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hi all,
I am building an app using GUIDE. I want to save the plot which is being displayed in my axes object. When user wants to plot, for instance, y(x) and z(x) on the same plot, different scales may be desired. For that I have the following:
cla(handles.axes1,'reset')
x1 = eval(x);
y1 = y(1,1);
y1 = eval(y1);
y3 = y(1,3);
y3 = eval(y3);
plotyy(x1,y1,x1,y3);
I then set up appropriate labels and the legend. Then I want to save that plot (axes with labels and the legend) in the current folder, in .jpg format, for instance. I tried the following:
fr = getframe(handles.axes1);
imwrite(fr.cdata, 'axes2.jpg');
But when I do so, the tick labels, or axis labels are not there (for neither of x or any of the y axis). I've also tried to use 'export_fig', but I get the error which says that 'export_fig' cannot save plots with multiple axis. Any ideas how to do what I'm trying to do?
2 comentarios
Adam
el 17 de Ag. de 2018
saveas would be simplest if you wanted the whole figure, but as you just want an axes can you not use the
getframe( __, rect )
syntax and give your figure handle together with a rectangle vertex definition that includes the full axes and ticks (which may just be a simple as the axes' 'Position' parameter I would think)?
Respuestas (0)
Ver también
Categorías
Más información sobre Creating, Deleting, and Querying Graphics Objects 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!