John Hunter wrote:
> On Fri, May 29, 2009 at 10:50 AM, Xavier Gnata <xavier.gn...@gmail.com> wrote:
>
>   
>>> I had the same problem and fixed it by changing just two lines of code in 
>>> the axes.py (line 1812 and 1814). Just change the formatter in 
>>> 'self.xaxis.major.formatter.set_scientific(sb)' to whatever you want (the 
>>> same for y).
>>>       
>
> You don't need to modify the internals of axes.py -- just set the
> formatter on the axes instance itself.
>
>   http://matplotlib.sourceforge.net/search.html?q=codex+set_major_formatter
>
>   
>> Indeed, but it should really be fixed in the svn.
>>     
>
> We could perhaps be a little smarter about this, but consider that one
> can easily plot lines over images
>
> In [30]: imshow(np.random.rand(512,512))
> Out[30]: <matplotlib.image.AxesImage object at 0x151c4f4c>
>
> In [31]: plot(np.arange(512), np.arange(512))
>
> Since the plot can be a mix of images, polygons, lines, etc, it is not
> obvious that the formatter should be int.  We could trap the case
> where you have only an image, no other data, and haven't set the
> extent, but it would be complicated because you may add data to the
> plot later and we would have to track that we had attempted to be
> clever but we should now undo our cleverness.  Our general philosophy
> is to make is easy for you to customize when the default behavior
> doesn't suit you, so try
>
>   import matplotlib.ticker as ticker
>   ax.xaxis.set_major_formatter(ticker.FormatStrFormatter('%d'))
>   .. and ditto for yaxis ..
>
> in addition to the ticks, you can customize how the coords appear in
> the toolbar by setting
>
>   ax.fmt_xdata = ticker.FormatStrFormatter('%d')
>   ... and ditto for fmt_ydata
>
> There are a variety of formatters available
>
>   http://matplotlib.sourceforge.net/api/ticker_api.html
>
> JDH
>   
Hi John,

Ok, well; the way I use pylab may be a corner case ;)

However, everyone would be happy if the default format would be consistent :

As it is, *by default*, when <1000 it displays an int and after 1000 it 
displays 1.42e3.
Why? What do you think this scientific format is a good for?

I understand some users would like to see floats by default.
Some other users would like to see integers by default.

I'm fine with integers or floats by default (I don't cadre) but I don't 
get the logic of the scientific format.
I only would like to see all the digits of the integer parts.
I would be fine if I would get 1.422e3 instead of 1.42e3 (we could for 
instance assume that images larger than (100 000, 100 000) are really a 
corner case ;)).

Why should be the *default* logic so strange?
Ok, it is easy to change but the default should at least make sense.
As it is, I don't think it does...but there could be a good rational I'm 
missing.

pylab is so easy and fun to use because the default settings are always 
the best one.
IMHO, there is one exception :(

Xavier



------------------------------------------------------------------------------
Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT 
is a gathering of tech-side developers & brand creativity professionals. Meet
the minds behind Google Creative Lab, Visual Complexity, Processing, & 
iPhoneDevCamp as they present alongside digital heavyweights like Barbarian 
Group, R/GA, & Big Spaceship. http://p.sf.net/sfu/creativitycat-com 
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to