Prev: block processing problem
Next: Curve matching question
From: Ziv on 21 May 2010 17:24 Hi, I have two figures e.g. gugu.fig and lulu.fig ) i want to place tham one next to the other and create gugululu.fig plot where gugu is on the right and lulu is on the left. can i call gugu and lulu from subplot? (wasn't able to do that). I've been reading some suggestions in this site, dealing with figure properties, copyobj, etc'. for some reason it didn't work ( I'd appreciate an example for creating such a merge. thanks, ZiV
From: Yi Cao on 21 May 2010 17:49 "Ziv " <ziv.yekutieli(a)hotmail.com> wrote in message <ht6tlk$k4t$1(a)fred.mathworks.com>... > Hi, > I have two figures e.g. gugu.fig and lulu.fig ) > i want to place tham one next to the other and create gugululu.fig plot where gugu is on the right and lulu is on the left. > > can i call gugu and lulu from subplot? (wasn't able to do that). > > I've been reading some suggestions in this site, dealing with figure properties, copyobj, etc'. for some reason it didn't work ( > > I'd appreciate an example for creating such a merge. > thanks, > ZiV One way to do this is to extract xdata and ydata from existing figures, then re-plot these data in a new figure window as desired. For example, open('gugu.fig'); h_gugu=get(gca,'Children'); x_gugu=get(h_gugu,'XData'); y_gugu=get(h_gugu,'YData'); open('lulu.fig'); h_lulu=get(gca,'Children'); x_lulu=get(h_lulu,'XData'); y_lulu=get(h_lulu,'YData'); figure subplot(121) plot(x_gugu,y_gugu); subplot(122) plot(x_lulu,y_lulu) saveas(gcf,'gugululu','fig') HTH Yi
From: Ziv on 22 May 2010 16:02 "Yi Cao" <y.cao(a)cranfield.ac.uk> wrote in message <ht6v4h$mt2$1(a)fred.mathworks.com>... > "Ziv " <ziv.yekutieli(a)hotmail.com> wrote in message <ht6tlk$k4t$1(a)fred.mathworks.com>... > > Hi, > > I have two figures e.g. gugu.fig and lulu.fig ) > > i want to place tham one next to the other and create gugululu.fig plot where gugu is on the right and lulu is on the left. > > > > can i call gugu and lulu from subplot? (wasn't able to do that). > > > > I've been reading some suggestions in this site, dealing with figure properties, copyobj, etc'. for some reason it didn't work ( > > > > I'd appreciate an example for creating such a merge. > > thanks, > > ZiV > > One way to do this is to extract xdata and ydata from existing figures, then re-plot these data in a new figure window as desired. For example, > > open('gugu.fig'); > h_gugu=get(gca,'Children'); > x_gugu=get(h_gugu,'XData'); > y_gugu=get(h_gugu,'YData'); > > open('lulu.fig'); > h_lulu=get(gca,'Children'); > x_lulu=get(h_lulu,'XData'); > y_lulu=get(h_lulu,'YData'); > > figure > subplot(121) > plot(x_gugu,y_gugu); > subplot(122) > plot(x_lulu,y_lulu) > saveas(gcf,'gugululu','fig') > > HTH > Yi Hi Yi, first, thanks for the prompt response, i can already get something going ) some questions still: when i run: >open('gugu.fig'); >h_gugu=get(gca,'Children'); i get: h_gugu = 172.3331 171.3347 why the two numbers? if i delete one of them i can get some progress and get the two subplots. do i get it right that i need to copy each and every property of the fig file? i.e. lines, colormap, titles etc'. is there a way to copy all together? thanks a lot for your help, ZiV
From: Matt Fig on 22 May 2010 16:17 This should work. You will get more than one child if there is more than one thing plotted or an annotation, etc. gu = open('gugu.fig'); gu_ax = gca; lu = open('lulu.fig'); lu_ax = gca; figure; % The new figure P = subplot(1,2,2); copyobj(get(gu_ax,'children'),P) P = subplot(1,2,1); copyobj(get(lu_ax,'children'),P)
From: Ziv on 23 May 2010 06:55
"Matt Fig" <spamanon(a)yahoo.com> wrote in message <ht9e40$5p4$1(a)fred.mathworks.com>... > This should work. You will get more than one child if there is more than one thing plotted or an annotation, etc. > > > > gu = open('gugu.fig'); > gu_ax = gca; > lu = open('lulu.fig'); > lu_ax = gca; > > figure; % The new figure > P = subplot(1,2,2); > copyobj(get(gu_ax,'children'),P) > P = subplot(1,2,1); > copyobj(get(lu_ax,'children'),P) Getting there ) but still something is missing: if the axes in lulu and gugu are not the same, for some reason i get the same axes in both subplots. I try to do the folllowing in order to change the axes seperatly but it doesn't work fine: Plu = subplot(1,2,1); PPlu=get(Plu,'Parent'); copyobj(get(lu,'children'),PPlu) I seem to override both subplots with lulu... |