Date: Sep 12, 2013 1:43 PM
Author: Sankalp Dayal
Subject: Re: Change xlabel of subplot with already stored figure

dpb <> wrote in message <l0r1u3$1mf$>...
> On 9/11/2013 6:22 PM, Sankalp Dayal wrote:
> Do NOT toppost... :(

> > I tried the exactly the same thing that was suggested but still it
> > doenst work. I have uploaded the files here

> > The one that doesnt work
> >
> >
> > The one that work
> >
> >

> ...
> Hmmm....same symptoms here, indeed. I can only conjecture something's
> different in the way the two were manipulated prior to saving -- like
> the positions of the axes were modified just enough to cause a floating
> point mismatch in the size comparison inside subplot() when it opens the
> one that thinks it's not the same position as the first.
> I see two workarounds --
> a) Find out what actually is causing the above symptom -- I'd start by
> using the default positions for subplot() and make the one that fails
> again and look at the position vector there and compare that to that of
> the saved version... or,
> b) Load the figures and then use the handles to the axes objects
> directly -- I think it will depend on how they were created as to the
> order but in the one that failed the two plot axes object handles are
> the 2nd and 4th and the legends are the 1st and 3rd...
> hfig=hgload('fig1.fig');
> hax=get(hfig,'children');
> xlabel(hax(2),'new label 1')
> xlabel(hax(4),'other new label')
> works as expected here while I do see the problem you outline on the
> subplot() open not recognizing the existing axis should seemingly match.
> --

I had plotted the figs without any precondition on x and y limits and then saved the figures using the saveas(..). Since when Matlab creates figure, it automatically adjusts x and y giving floating point range limits; thereby causing the problem.

Your new solution works awesome. Thanks!