From: John H. <jdh...@ac...> - 2004-04-19 22:29:26
|
>>>>> "Srinath" == Srinath Avadhanula <sr...@fa...> writes: Srinath> Hello, I seem to have uncovered a bug in setting/updating Srinath> 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 |