On Sat, Sep 11, 2010 at 6:57 PM, freeeeeekk <freeeee...@gmail.com> wrote:
> > Im trying to do a very simple x vs y plot. Where the x values range between > 3247 and 3256 and y between 0 and 1. This data is stored in data.dat. I > plot > it using the code below, the resulting plot is shown in the first of the > two > plots below. Everything goes well except for the x axis, for some reason > tickmarks from 0 up to 9 appear. At the far end of the axis my xmin is > printed: 3.247e3. > I started looking for the cause and it turns out that as long as my range > in > x is lower than 10, this happens. If I change the xlimits to > xlim(3246,3256) > I get the plot at the bottom of this page, everything is fine. But if I > change this to for instance xlim(3246.01,3256) or xlim(3245, 3254.99) I get > the same behaviour as in the first graph. > > Does any one have any experience with this/ know the reason for this > happening? Thanks! > > from numpy import * > from pylab import * > > datafile = mlab.load('./data.dat') > xx=datafile[:,0] > yy=datafile[:,1] > > plot(xx,yy,'black') > xlim(3247,3256) > ylim(0,1.2) > > show() > > > http://old.nabble.com/file/p29687404/wrong.png > http://old.nabble.com/file/p29687404/right.png > What is happening isn't a bug, it is a feature, although it probably could be done a little bit better. When the range of values to display for ticks is fairly small compared to the size of the values, then matplotlib displays only the part that changes as a value relative to some constant offset. In your case, the constant offset is the +3.247e3 on the right hand side of the axis. This can also happen for the y-axis as well. This is similar to the idea of how matplotlib would display very large numbers like range(1e7, 10e7, 1e7) as "1 2 3 4 5 6 7 8 9" with a 1e7 at the end of the axis. I hope this makes sense. Ben Root
------------------------------------------------------------------------------ Start uncovering the many advantages of virtual appliances and start using them to simplify application deployment and accelerate your shift to cloud computing http://p.sf.net/sfu/novell-sfdev2dev
_______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users