Use copyobj for specific properties -> subplot
3 次查看(过去 30 天)
显示 更早的评论
Hello everyone, at the moment I'm trying to create a callback function which copies the main properties of some of my GUIs axes to a subplot in a new window. The problem is that I don't know how to select just some specific properties and leave out others. My callback works fine with
plotdata= findall(handles.axes1);
plotdata=plotdata(2:end);
%or plotdata=get(Axeshandle,'children'); but this doesn't give me the labels for example
sp=subplot(2,2,[1,3]);
copyobj(plotdata,sp);
but in this case it also copies the locations of the labels so that they seem misplaced on my subplot. The properties I'm interested in copying are: -xlim -ylim -xtick -ytick -the plot(with colour) -xlabel(with colour, font and size) -ylabel (with colour, font and size)
The rest, like the position of the subplot, should remain as in the default subplot-settings.(so that labels do not cross each other)
Is there a way to get all properties mentioned above into a structure which I can copy with copyobj?
And a second questions relating to this is whether there is a command to clear the subplot before using copyobj.
At the moment the plots overwrite each other. (I tried "cla;" but this clears all the subplots and not a particular one. "clear subplot(2,2,[1,3]);" doesnt work either.) It works if I do it with the subplot handles and always delete the handle previously to the plotting but then I also have to check if the subplot handle exists, which gives me another ifloop and kind of seems too complex for such a simple task)
Thank you for your help! Klaus
回答(1 个)
Jan
2015-5-30
The documentation of cla reveals, how to clear the contents of a specific axes:
axesH = subplot(2,2,[1,3]);
cla(axesH);
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Subplots 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!