How to save an axes GUI object which of the scales on the left and the right y axis differ?
3 ビュー (過去 30 日間)
古いコメントを表示
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 件のコメント
Adam
2018 年 8 月 17 日
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)?
回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Creating, Deleting, and Querying Graphics Objects についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!