Hi Thorsten,

On Wednesday 09 January 2008 15:35, Thorsten Kranz wrote:
> Hi list, Hi Matthias,
>
> I found another way to deal with this problem. when defining the colorbar,
> one can give an additional kwarg "format", so by defining the kwarg
> "format=formatter", we solved the problem.

I'm happy that your problem disappeared, but I still have a question. On my 
system the problem still exist, if I use "format=formatter" in colorbar and 
after that use 
cb.ax.yaxis.set_major_formatter(formatter)
in the example-code of my last email. 
Can anybody confirm this behaviour (data range 0.0 ... 0.54 -> 0.0 ... 0.95)? 
And if so: Is this the expected behaviour?

best regards,
Matthias


> Anyway, I think an option as Matthias implemented would be very handy for
> all those users like us here in Germany who might want to have the numbers
> formatted with commata.
>
> Greetings,
> Thorsten
>
> 2008/1/9, Matthias Michler <[EMAIL PROTECTED]>:
> > Hello list,
> > Hello Thorsten,
> >
> > On Wednesday 09 January 2008 11:38, Thorsten Kranz wrote:
> > > I have a question concerning reformatting of axis-ticks via the
> > > FuncFormatter-class. In german, it's common to use a comma as separator
> >
> > for
> >
> > > decimal numbers instead of a dot. To realize it in matplotlib, I do
> > > something like
> > >
> > > >from matplotlib.ticker import FuncFormatter
> > >
> > > import pylab
> > > pylab.figure()
> > > formatter = FuncFormatter(lambda x,pos: ("%.2f"%x).replace(".",","))
> > > ax = pylab.axes()
> > > ax.xaxis.set_major_formatter(formatter)
> > > ax.yaxis.set_major_formatter(formatter)
> > > ax.plot(pylab.arange(0,1,0.1),pylab.arange(0,1,0.1))
> > > This works fine for me,
> >
> > I had the same idea ;-). The problem is that you have a fixed number of
> > digits
> > behind the comma, which is not the desirable behaviour during zoom.
> > I changed the ticker.py/ axes.py files to circumwait this disadvantage. I
> > attached a patch showing my changes and maybe somebody can test it.
> > You can activate it using:
> >   ax.ticklabel_format(style='comma')
> > for an ScalarFormatter
> >
> > > but I encounter a problem when I do an
> > > imshow-command with a colorbar. In the imshow-axes, it's o.k., but for
> >
> > the
> >
> > > colorbar it doesn't really work. I do
> > >
> > > cb = pylab.colorbar()
> > > cb.ax.yaxis.set_major_formatter(formatter)
> > >
> > > and, actually, all dots are replaced by com9mata, but the values are
> >
> > also
> >
> > > changed! E.g. instead of the old values (without formatter) from
> > > 0-0.54, the
> > >
> > > values are increased to 0-0.95.
> >
> > [...]
> >
> > > Can anyone explain why it doesn't work out as I expect it to work?
> >
> > I don't know were the problem comes from. I attached your example in a
> > slitly
> > modified version and this shows that the problem is not due to your
> > special
> > formatting. It occurs with matplotlib.ticker.ScalarFormatter, too.
> >
> > best regards,
> > Matthias
> >
> > > Or is there a better, more standard way to substitute the dots by
> >
> > commata?
> >
> > > Thanks,
> > > Thorsten
> >
> > -------------------------------------------------------------------------
> > Check out the new SourceForge.net Marketplace.
> > It's the best place to buy or sell services for
> > just about anything Open Source.
> >
> > http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketpl
> >ace _______________________________________________
> > Matplotlib-users mailing list
> > Matplotlib-users@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/matplotlib-users

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to