## Re: [Matplotlib-users] Forcing full value on axis

 Re: [Matplotlib-users] Forcing full value on axis From: John T Whelan - 2007-04-25 07:06:10 ```On Tue, 24 Apr 2007, Tommy Grav wrote: > I have a plot where the x axis ticks are given as > 0.1 0.15 0.20 0.025 0.30 0.35 > with +3.732e2 given in the lower right of the axis. > How can I force the ticks to have > 373.3 373.35 .... If all else fails, you can set the tick labels by hand. For example, I did this when trying to get tick labels of 0.002, 0.0025, 0.003, etc.: tickvals = arange(0.002,0.007,0.0005); ticklabs = map(lambda val:"%.4f"%val, tickvals); ticklabs[0:9:2] = map(lambda val:"%.3f"%val, tickvals[0:9:2]); xticks(tickvals,ticklabs); -- ====================================================================== Office: 0.17 (Golm) Dr. John T. Whelan Phone: +49 331 567 7117 MPI for Gravitational Physics FAX: +49 331 567 7298 (Albert-Einstein Institute) http://www.aei.mpg.de/~whelan/ D-14424 Potsdam john.whelan@... john.whelan@... ====================================================================== ```

 [Matplotlib-users] Forcing full value on axis From: Tommy Grav - 2007-04-24 15:31:08 ```I have a plot where the x axis ticks are given as 0.1 0.15 0.20 0.025 0.30 0.35 with +3.732e2 given in the lower right of the axis. How can I force the ticks to have 373.3 373.35 .... and so on? Cheers Tommy ```
 Re: [Matplotlib-users] Forcing full value on axis From: John Hunter - 2007-04-24 19:10:18 ```On 4/24/07, Tommy Grav wrote: > I have a plot where the x axis ticks are given as > > 0.1 0.15 0.20 0.025 0.30 0.35 > > with +3.732e2 given in the lower right of the axis. > How can I force the ticks to have > 373.3 373.35 .... > It always helps if you give us complete examples that we can run -- then we can give you back tested answers we know work. You should be able to tweak the axes.formatter.limits rc param. Something like import matplotlib matplotlib.rcParams['axes.formatter.limits'] = -15,15 before you make your plots. If this doesn't work, please post a complete example. Darren, for the range he is using according to his post, I wouldn't expect the exponential formatting to be kicking in since log10(.4) = -.4 which is within the default range. JDH ```
 Re: [Matplotlib-users] Forcing full value on axis From: John T Whelan - 2007-04-25 07:06:10 ```On Tue, 24 Apr 2007, Tommy Grav wrote: > I have a plot where the x axis ticks are given as > 0.1 0.15 0.20 0.025 0.30 0.35 > with +3.732e2 given in the lower right of the axis. > How can I force the ticks to have > 373.3 373.35 .... If all else fails, you can set the tick labels by hand. For example, I did this when trying to get tick labels of 0.002, 0.0025, 0.003, etc.: tickvals = arange(0.002,0.007,0.0005); ticklabs = map(lambda val:"%.4f"%val, tickvals); ticklabs[0:9:2] = map(lambda val:"%.3f"%val, tickvals[0:9:2]); xticks(tickvals,ticklabs); -- ====================================================================== Office: 0.17 (Golm) Dr. John T. Whelan Phone: +49 331 567 7117 MPI for Gravitational Physics FAX: +49 331 567 7298 (Albert-Einstein Institute) http://www.aei.mpg.de/~whelan/ D-14424 Potsdam john.whelan@... john.whelan@... ====================================================================== ```