Bug with setting axis limits

Hello, I seem to have uncovered a bug in setting/updating

    > the axis limits.

Hi, I have looked into this and it is indeed a bug. Here is what is
going on: The transforms for x and y take your view limits and map
them to display coords, where negative numbers don't make sense. It
is a standard linear transformation

        scale = displayInterval/viewInterval
        return scale*(y-viewMin) + displayMin

In your example, if the y axis view limits are [0.516, 0.52] and the
display interval is [44.0, 360.0], then transformation of the y vector
[0, 1].

  scale = (360-44)/0.004
  ytransformed = scale*(y-.516) + 44

which is [-40720., 38280.]

Ie, when your nearest data point is much smaller than your view
limits, you get negative display coords which are undefined. I am not
sure this case is common enough to warrant the performance hit of
detecting it and doing the linear interpolation necessary to add
pseudo data points to make your plot well defined. Simply replacing
the negative data with 0 is incorrect because you have to do linear
interpolation to get the right location in display coords. Perhaps a
warning if min(xtransformed)<0 or min(ytransformed)<0 would be
appropriate and worth the performance hit.

If you have some ideas on what is the best way to handle this case,
let me know.

JDH

    > Hello, I seem to have uncovered a bug in setting/updating
    > the axis limits.

limits, you get negative display coords which are undefined. I am not
sure this case is common enough to warrant the performance hit of
detecting it and doing the linear interpolation necessary to add

I have no time right now to go into a technical discussion, but IMHO
this is a serious enough bug that it needs to be fixed. One can only
worry about performance after doing the right thing. It doesn't make
sense to give the completely wrong answer in a shorter time.
[Sorry, I do not mean to sound curt or rude. Excuse me if it sounds that
way.]

Besides whether or not its a common enough situation is very application
specific. I was planning to use matplotlib to display a complex layout.
At the original scale, not much can be seen. There necessarily has to be
a lot of scaling to see the details.

If you have some ideas on what is the best way to handle this case,
let me know.

Could you let me know which files in matplotlib have the code in
question? I'll take a look then.

Srinath

···

On Mon, 19 Apr 2004, John Hunter wrote: