Anyone find an answer to this one?  I'm running into this issue with 0.90.1 and I found this in the archives.  I tried the suggested code and it doesn't seem to work for me.  Right now my workaround is

        min_x = min([min(line.get_xdata()) for line in self.axes.lines])
        max_x = max([max(line.get_xdata()) for line in self.axes.lines])           

Any suggestions?


On Tue, Nov 14, 2006 at 8:13 PM, Andrea Gavana <> wrote:
Hi John,

   sorry to come back so late with this subject. Well, I have tried
your suggestion:

> When you add lines to the plot, the dataLim are updated, but when you
> remove data with del ax.lines[-1] etc, the dataLim are not updated.
> If all you have in the Axes are line instances, you can update the
> dataLim with the remaining lines, but first you must tell it to ignore
> it's current limits.  You do this with the ignore flag
> # after removing a line, do
> ignore = True
> for line in ax.lines:
>    x = line.get_xdata()
>    y = line.get_ydata()
>    ax.dataLim.update_numerix(x, y, ignore)
>    ignore = False

No way, it doesn't update the axes. Uhm, in my plot I have only lines
and one legend, nothing more. Even if I try a simple case with 2 lines
and I remove one of them, the axes still stay with their previous
limits. I must be missing something.

> After you have tested this, would you mind updating the wiki with this
> information?

No problem, as soon as I am able to update the axes, I will add that
info to the wiki.

Thank you.


"Imagination Is The Only Weapon In The War Against Reality."

Take Surveys. Earn Cash. Influence the Future of IT
Join's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
Matplotlib-users mailing list