[Matplotlib-users] Scientific notation digits at left-bottom corner of figure

Ardeal LIANG ardeal.liang at philips.com
Sun Oct 29 22:29:27 EDT 2017


Hi Jody,

Please check the red ellipse in the picture.

I want the value 1.85092e+06 to be 1850922 in the red ellipse in the following picture.


fmt_no_sci = ScalarFormatter(useOffset=False)
fmt_no_sci.set_scientific(False)
# ax.fmt_xaxis = fmt_no_sci

fig = plt.figure()
ax = fig.add_subplot(111)
ax.plot(testdata)
ax.fmt_xaxis = fmt_no_sci
plt.show(0)



The x axis value displayed at the left-bottom corner of the figure is still scientific notation, but not decimal notation.

Please check the x axis value displayed at the left-bottom corner of the figure in the red circle.

[cid:image001.jpg at 01D35169.F2F33F40]






Best Regards,
Ardeal Liang

From: Jody Klymak [mailto:jklymak at uvic.ca]
Sent: 2017年10月30日 10:24
To: Ardeal LIANG <ardeal.liang at philips.com>
Cc: Firing Eric <efiring at hawaii.edu>; matplotlib-users at python.org
Subject: Re: [Matplotlib-users] Scientific notation digits at left-bottom corner of figure




On Oct 29, 2017, at  17:46 PM, Ardeal LIANG <ardeal.liang at philips.com<mailto:ardeal.liang at philips.com>> wrote:

HI Eric,

Did you review the picture attached in my former email?
I suspect you go to the wrong direction about what I want to ask.

Best Regards,
Ardeal Liang

Hi Ardeal,

Its not clear to me what you want.  Do you want 3.2 x 10^3 instead of 0.0032?  The former is scientific and the latter decimal.

Thanks,  Jody





-----Original Message-----
From: Eric Firing [mailto:efiring at hawaii.edu]
Sent: 2017年10月28日 1:23
To: Ardeal LIANG <ardeal.liang at philips.com<mailto:ardeal.liang at philips.com>>; matplotlib-users at python.org<mailto:matplotlib-users at python.org>
Subject: Re: [Matplotlib-users] Scientific notation digits at left-bottom corner of figure

I'm getting a different result, but on the basic point we now agree:
the ScalarFormatter is not the right tool for this.  What you need is a function that takes a number and returns the kind of string you want.

Examples:

def format_as_int(num):
    return str(int(num))

def format_float_no_sci(num):
    return "%f" % num

Eric

On 2017/10/26 10:07 PM, Ardeal LIANG wrote:

Hi Eric,

I added your code to my code:

*from *matplotlib.ticker *import *ScalarFormatter

fmt_no_sci = ScalarFormatter(useOffset=False)
fmt_no_sci.set_scientific(False)

/# ax.fmt_xaxis = fmt_no_sci

/prow = 4
pcol = 1
pidx = 0
fig = plt.figure()
pidx += 1
axx = fig.add_subplot(prow, pcol, pidx, ylabel=*'rawdata'*)
axx.plot(np.abs(testdata))

axx.fmt_xaxis = fmt_no_sci

The *x axis value displayed at the left-bottom corner of the figure*is
still scientific notation, but not decimal notation.

Best Regards,

Ardeal Liang

-----Original Message-----
From: Matplotlib-users
[mailto:matplotlib-users-bounces+ardeal.liang=philips.com at python.org]
On Behalf Of Eric Firing
Sent: 2017年10月27日 16:00
To: matplotlib-users at python.org<mailto:matplotlib-users at python.org>
Subject: Re: [Matplotlib-users] Scientific notation digits at
left-bottom corner of figure

On 2017/10/26 9:50 PM, Ardeal LIANG wrote:


Hi,





If I put the mouse on the figure, x and y axis are displayed on the


left-bottom corner of the figure.


but the x axis is displayed as scientific notation, I want it to be


displayed as decimal notation.





how to make x axis or y axis values displayed as decimal notation
on


the left-bottom corner?





*Best Regards,*





*Ardeal Liang*

Something like this, assuming your Axes is ax:

from matplotlib.ticker import ScalarFormatter

fmt_no_sci = ScalarFormatter(useOffset=False)

fmt_no_sci.set_scientific(False)

ax.fmt_xaxis = fmt_no_sci

Eric

_______________________________________________

Matplotlib-users mailing list

Matplotlib-users at python.org<mailto:Matplotlib-users at python.org> <mailto:Matplotlib-users at python.org>

https://mail.python.org/mailman/listinfo/matplotlib-users


----------------------------------------------------------------------
-- The information contained in this email may be confidential and/or
legally protected under applicable law. The message is intended solely
for the addressee(s). If you are not the intended recipient, you are
hereby notified that any use, forwarding, dissemination, or
reproduction of this email is strictly prohibited and may be unlawful.
If you are not the intended recipient, please contact the sender by
return e-mail and destroy all copies of the original email.


________________________________
The information contained in this email may be confidential and/or legally protected under applicable law. The message is intended solely for the addressee(s). If you are not the intended recipient, you are hereby notified that any use, forwarding, dissemination, or reproduction of this email is strictly prohibited and may be unlawful. If you are not the intended recipient, please contact the sender by return e-mail and destroy all copies of the original email.
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users at python.org<mailto:Matplotlib-users at python.org>
https://mail.python.org/mailman/listinfo/matplotlib-users


________________________________
The information contained in this email may be confidential and/or legally protected under applicable law. The message is intended solely for the addressee(s). If you are not the intended recipient, you are hereby notified that any use, forwarding, dissemination, or reproduction of this email is strictly prohibited and may be unlawful. If you are not the intended recipient, please contact the sender by return e-mail and destroy all copies of the original email.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/matplotlib-users/attachments/20171030/0061e5b3/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.jpg
Type: image/jpeg
Size: 127364 bytes
Desc: image001.jpg
URL: <http://mail.python.org/pipermail/matplotlib-users/attachments/20171030/0061e5b3/attachment-0001.jpg>


More information about the Matplotlib-users mailing list