## matplotlib-users

 [Matplotlib-users] Re: new scientific notation format From: Sascha Schnepp - 2005-05-03 07:26:06 ```Hi, this seems to be very nice! Unfortunately my knowledge about the inner li= fe of matplotlib is not that deep, so I didn't understand where and what = to change to benefit from the new format. Could you please give some further information. Thanks! Sascha =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > Message: 7 > From: Darren Dale > Reply-To: dd55@... > To: matplotlib-devel@..., > matplotlib-users@... > Date: Mon, 2 May 2005 19:57:08 -0400 > Subject: [Matplotlib-users] new scientific notation format >Hi Everyone, >There is a new formatter in ticker.py called NewScalarFormatter. If you = have > scientific notation in your plots, you may like the results. If you wou= ld > like to try it out, you need to change ScalarFormatter->OldScalarFormat= ter, > and NewScalarFormatter->ScalarFormatter. It will then be the default fo= r > linear scale axes. I would appreciate feedback, it will hopefully becom= e the > default at some point. >Darren >--__--__-- >Message: 8 > To: dd55@... > Cc: matplotlib-users@... > From: John Hunter > Date: Mon, 02 May 2005 21:08:20 -0500 > Subject: [Matplotlib-users] Re: [matplotlib-devel] new scientific notat= ion format > >>>>>> "Darren" =3D=3D Darren Dale writes: > Darren> Hi Everyone, There is a new formatter in ticker.py called > Darren> NewScalarFormatter. If you have scientific notation in > Darren> your plots, you may like the results. If you would like to > Darren> try it out, you need to change > Darren> ScalarFormatter->OldScalarFormatter, and > Darren> NewScalarFormatter->ScalarFormatter. It will then be the > Darren> default for linear scale axes. I would appreciate > Darren> feedback, it will hopefully become the default at some > Darren> point. >Maybe you can provide an example that illustrates the range of normal > and pathological changes that the new formatter is designed to > address, so that people can compare the results visually. >The basic problem the new formatter is trying to solve is to properly > format cases where the view limits range from something like 2e10 to > 2e10+5. > from pylab import * > x =3D arange(5.0) > plot(x+2e10, x) > show() >Ie, limits where the range is small compared to end values. In this > case the new formatter figures out what the offset is, factors it out > of the ticks, and displays it on the axis, so for the case above, you > would see something like this for the x-axis > ---------------------------------------------- > 0 1 2 3 4 5 > +2e10 >and the location of the offset text (2e10) is configurable. ```
 Re: [Matplotlib-users] Re: new scientific notation format From: Darren Dale - 2005-05-03 13:28:57 ```On Tuesday 03 May 2005 3:25 am, Sascha Schnepp wrote: > Hi, > > this seems to be very nice! Unfortunately my knowledge about the inner life > of matplotlib is not that deep, so I didn't understand where and what to > change to benefit from the new format. > > Could you please give some further information. Sure, I forgot to mention that I made the changes in CVS, so for now you will need to get a fresh copy of MPL from CVS, make the changes I suggested in ticker.py, remove your old MPL from python/site-packages, and install from CVS. If you dont want to deal with CVS, you can probably try it in the next release. In addition to the example John gave, there are two more improvements. If you plot(arange(0,5e10,1e9)) you would get something like this: ---------------------------------------------- 0 1 2 3 4 5 x1e10 if you plot(arange(0,5e6,1e5)+2e10) you would get something like this: ---------------------------------------------- 0 1 2 3 4 5 x1e6+2e10 Finally, I look at all the ticklabels together to figure out how to format them. Labels that used to look like this: ---------------------------------------------- 0 0.5 1 1.5 2 2.5 Will now look like this: ---------------------------------------------- 0 0.5 1.0 1.5 2.0 2.5 I think it looks better, especially on the y axis. > > =================================================================== > > > Message: 7 > > From: Darren Dale > > Reply-To: dd55@... > > To: matplotlib-devel@..., > > matplotlib-users@... > > Date: Mon, 2 May 2005 19:57:08 -0400 > > Subject: [Matplotlib-users] new scientific notation format > >Hi Everyone, > >There is a new formatter in ticker.py called NewScalarFormatter. If you > > have scientific notation in your plots, you may like the results. If you > > would like to try it out, you need to change > > ScalarFormatter->OldScalarFormatter, and > > NewScalarFormatter->ScalarFormatter. It will then be the default for > > linear scale axes. I would appreciate feedback, it will hopefully become > > the default at some point. > >Darren > >--__--__-- > >Message: 8 > > To: dd55@... > > Cc: matplotlib-users@... > > From: John Hunter > > Date: Mon, 02 May 2005 21:08:20 -0500 > > Subject: [Matplotlib-users] Re: [matplotlib-devel] new scientific > > notation format > > > >>>>>> "Darren" == Darren Dale writes: > > > > Darren> Hi Everyone, There is a new formatter in ticker.py called > > Darren> NewScalarFormatter. If you have scientific notation in > > Darren> your plots, you may like the results. If you would like to > > Darren> try it out, you need to change > > Darren> ScalarFormatter->OldScalarFormatter, and > > Darren> NewScalarFormatter->ScalarFormatter. It will then be the > > Darren> default for linear scale axes. I would appreciate > > Darren> feedback, it will hopefully become the default at some > > Darren> point. > >Maybe you can provide an example that illustrates the range of normal > > and pathological changes that the new formatter is designed to > > address, so that people can compare the results visually. > >The basic problem the new formatter is trying to solve is to properly > > format cases where the view limits range from something like 2e10 to > > 2e10+5. > > from pylab import * > > x = arange(5.0) > > plot(x+2e10, x) > > show() > >Ie, limits where the range is small compared to end values. In this > > case the new formatter figures out what the offset is, factors it out > > of the ticks, and displays it on the axis, so for the case above, you > > would see something like this for the x-axis > > ---------------------------------------------- > > 0 1 2 3 4 5 > > +2e10 > >and the location of the offset text (2e10) is configurable. > > ------------------------------------------------------- > This SF.Net email is sponsored by: NEC IT Guy Games. > Get your fingers limbered up and give it your best shot. 4 great events, 4 > opportunities to win big! Highest score wins.NEC IT Guy Games. Play to > win an NEC 61 plasma display. Visit http://www.necitguy.com/?r > _______________________________________________ > Matplotlib-users mailing list > Matplotlib-users@... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Darren S. Dale Bard Hall Department of Materials Science and Engineering Cornell University Ithaca, NY. 14850 dd55@... ```
 Re: [Matplotlib-users] Re: new scientific notation format From: Stephen Walton - 2005-05-04 11:36:56 ```I tried out the new tick formatter, which is very nice. That said, the new formatter doesn't work if one is using numarray 1.2.3 as numerix. The bug is in numarraycore.py, where all instances of add.reduce have to change to ufunc.add.reduce; this was fixed in numarray 1.3.1. Just hoping to save some others a bit of work; I'm sure many of you are not as compulsive as I am about doing upgrades ;-) ```