Quantcast
Channel: MATLAB Central Newsreader - merging existing .fig into the same figure
Viewing all articles
Browse latest Browse all 15

Re: merging existing .fig into the same figure

$
0
0
"Yi Cao" <y.cao@cranfield.ac.uk> wrote in message <ht6v4h$mt2$1@fred.mathworks.com>...
> "Ziv " <ziv.yekutieli@hotmail.com> wrote in message <ht6tlk$k4t$1@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

Viewing all articles
Browse latest Browse all 15

Trending Articles