Date: Sep 12, 2013 1:43 PM
Author: Sankalp Dayal
Subject: Re: Change xlabel of subplot with already stored figure
dpb <email@example.com> wrote in message <firstname.lastname@example.org>...
> 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
> > https://docs.google.com/file/d/0B5jOXNF7SvrgbVVESFp0ZXYzeFk/edit?usp=sharing
> > The one that work
> > https://docs.google.com/file/d/0B5jOXNF7SvrgNTZ5ZkFzdlBwcjQ/edit?usp=sharing
> 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...
> 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!