[Matplotlib-users] When data is graphed with an offset

Thomas Caswell tcaswell at gmail.com
Wed Jun 22 20:50:56 EDT 2016


John,

This seems to be a common question (
http://stackoverflow.com/questions/14711655/how-to-prevent-numbers-being-changed-to-exponential-form-in-python-matplotlib-fi/14711866#14711866
)

ax = plt.gca()
ax.get_xaxis().get_major_formatter().set_useOffset(False)
ax.get_yaxis().get_major_formatter().set_useOffset(False)

will control a single axes

To control it globally set `axes.formatter.useoffset: False` in rcparams.
see http://matplotlib.org/users/customizing.html#a-sample-matplotlibrc-file


Where would you have expected to look for this information in the
documentation?

Tom

PS the sourceforge list is no longer used, please send future mail to
matplotlib-users at python.org


On Wed, Jun 22, 2016 at 8:30 PM John Ladasky <jladasky at itu.edu> wrote:

> Hi there,
>
> I have been subscribed to matplotlib-users before.  I have a new job, and
> now I'm connecting from a new email address.  I've been using Matplotlib
> since before 1.0 was released.  Currently, I'm using MPL 1.4.2 and Python
> 3.5 on Ubuntu Linux 15.04 (if any of that matters).
>
> Please have a look at the following graph:
>
> [image: For matplotlib discussion.png]
>
> The values in the data set used to plot these two graphs range from 14942
> to 14948.  In other words, the median of the data set is very far from
> zero, but the range of the data is very small.  With such a data set, MPL
> subtracts a large offset value from the data points, choosing a value such
> that the remaining differences are small, positive numbers.  I understand
> the logic behind this, it simplifies graph labeling on the x-axis of the
> left graph, and the y-axis of the right graph.
>
> However, I do not like the way that MPL is displaying the offset value.
> It is written in small text, and it does not show up in a consistent
> place.  On a figure with many adjacent axes, it sometimes isn't clear which
> axes owns the annotation.  I would prefer to incorporate the offset in the
> axes title: for example, the title of the left graph could read "internal
> thermistor (+14940)".
>
> So, what is this offset value called in Matplotlib?  How do I retrieve
> it?  How can I override its display?  I can obviously do this by wrapping
> these particular plots in functions which apply the offset before giving
> the data to MPL.  But I would prefer to work with MPL itself, as I don't
> always know when MPL will judge that a data offset value is needed.
>
> Thanks for your help!
> --
> *John J. Ladasky Jr., Ph.D.*
> *Research Scientist*
> *International Technological University*
> *2711 N. First St, San Jose, CA 95134 USA*
>
> ------------------------------------------------------------------------------
> Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San
> Francisco, CA to explore cutting-edge tech and listen to tech luminaries
> present their vision of the future. This family event has something for
> everyone, including kids. Get more information and register today.
> http://sdm.link/attshape_______________________________________________
> Matplotlib-users mailing list
> Matplotlib-users at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/matplotlib-users/attachments/20160623/0b223e91/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: For matplotlib discussion.png
Type: image/png
Size: 30819 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/matplotlib-users/attachments/20160623/0b223e91/attachment-0001.png>


More information about the Matplotlib-users mailing list