Axis Limits and Dash Text Misbehaviours

Hi All,

    I have switched from matplotlib 0.91.2 to 0.98.1, and I have
noticed a couple of "strange" behaviours (I am not using PyLab, but
matplotlib embedded in wxPython):

1) If I use:

ylims = self.myAxis.get_ylim()

And then I add other lines to the plot, the value of ylims is
modified. It gets modified even if I use something like this:

ylims = self.myAxis.get_ylim()[:]

The only way of keeping the ylims list untouched by other plotting
commands I have to do this:

ylims = copy.deepcopy(self.leftaxis.get_ylim())

Which is a bit of an overkill. See the attached Python script for an
example. This did not happen before in 0.91.2.

2) The dashed text positioning is wrong, you can see it by running
dashpointlabel.py in the
matplotlib_examples_0.98.1\examples\pylab_examples: the position of
the values should be at the other end of the dash, not over the
plotted point.

Am I missing something?

Thank you for your suggestions.

Andrea.

"Imagination Is The Only Weapon In The War Against Reality."
http://xoomer.alice.it/infinity77/

get_ylim_strangeness.py (1.14 KB)

Andrea Gavana wrote:

Hi All,

    I have switched from matplotlib 0.91.2 to 0.98.1, and I have
noticed a couple of "strange" behaviours (I am not using PyLab, but
matplotlib embedded in wxPython):

1) If I use:

ylims = self.myAxis.get_ylim()

And then I add other lines to the plot, the value of ylims is
modified. It gets modified even if I use something like this:

ylims = self.myAxis.get_ylim()[:]

The only way of keeping the ylims list untouched by other plotting
commands I have to do this:

ylims = copy.deepcopy(self.leftaxis.get_ylim())

Which is a bit of an overkill. See the attached Python script for an
example. This did not happen before in 0.91.2.
  

That is the intended behavior and is preferred in many cases. Most of the transformations and dimensions are now stored in numpy arrays that are mutable and updated in place. Since these are numpy arrays, you could also do:

  ylims = self.leftaxis.get_ylim().copy()

which is a bit less typing.

Sorry about the change. I will note it in the API_CHANGES document.

2) The dashed text positioning is wrong, you can see it by running
dashpointlabel.py in the
matplotlib_examples_0.98.1\examples\pylab_examples: the position of
the values should be at the other end of the dash, not over the
plotted point.
  

Yes, you're right. That is a bug. I will look into this.

Cheers,
Mike

···

--
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA

Andrea Gavana wrote:

2) The dashed text positioning is wrong, you can see it by running
dashpointlabel.py in the
matplotlib_examples_0.98.1\examples\pylab_examples: the position of
the values should be at the other end of the dash, not over the
plotted point.
  

I believe I have this fixed in SVN. Please kick the tires and let me know if you still have problems.

Cheers,
Mike

···

--
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA

Hi Michael,

Andrea Gavana wrote:

2) The dashed text positioning is wrong, you can see it by running
dashpointlabel.py in the
matplotlib_examples_0.98.1\examples\pylab_examples: the position of
the values should be at the other end of the dash, not over the
plotted point.

I believe I have this fixed in SVN. Please kick the tires and let me know
if you still have problems.

Thank you for the very fast answer and fix. Everything looks fine at
the moment, I'll do some more testing on monday but I don't expect any
problem.

Thank you!

Andrea.

"Imagination Is The Only Weapon In The War Against Reality."
http://xoomer.alice.it/infinity77/

···

On Fri, Jun 27, 2008 at 7:54 PM, Michael Droettboom wrote:

Hi All,

Hi Michael,

> Andrea Gavana wrote:
>>
>> 2) The dashed text positioning is wrong, you can see it by running
>> dashpointlabel.py in the
>> matplotlib_examples_0.98.1\examples\pylab_examples: the position of
>> the values should be at the other end of the dash, not over the
>> plotted point.
>>
>
> I believe I have this fixed in SVN. Please kick the tires and let me know
> if you still have problems.

It seems like Michael changes were reverted back to the previous
behaviour. I have scanned the matplotlib-devel archives and found the
reason. Even if the message says that text.py is fixed, I still see
the problem I was having in dashpointlabel.py example using the latest
text.py from SVN. I am probably missing something...

Andrea.

"Imagination Is The Only Weapon In The War Against Reality."
http://xoomer.alice.it/infinity77/

···

On 6/27/08, Andrea Gavana wrote:

On Fri, Jun 27, 2008 at 7:54 PM, Michael Droettboom wrote:

The changes that fixed dashpointlabel broke plain-vanilla tick layout,
which also use a TextWithDash. So I temporarily reverted them until
we can get a fix that works with all the examples.

Sorry for the confusion.

JDH

···

On Mon, Jun 30, 2008 at 3:32 AM, Andrea Gavana <andrea.gavana@...287...> wrote:

It seems like Michael changes were reverted back to the previous
behaviour. I have scanned the matplotlib-devel archives and found the
reason. Even if the message says that text.py is fixed, I still see
the problem I was having in dashpointlabel.py example using the latest
text.py from SVN. I am probably missing something...

This should be fixed now in svn.

Darren

···

On Monday 30 June 2008 09:01:48 John Hunter wrote:

On Mon, Jun 30, 2008 at 3:32 AM, Andrea Gavana <andrea.gavana@...287...> wrote:
> It seems like Michael changes were reverted back to the previous
> behaviour. I have scanned the matplotlib-devel archives and found the
> reason. Even if the message says that text.py is fixed, I still see
> the problem I was having in dashpointlabel.py example using the latest
> text.py from SVN. I am probably missing something...

The changes that fixed dashpointlabel broke plain-vanilla tick layout,
which also use a TextWithDash. So I temporarily reverted them until
we can get a fix that works with all the examples.