# [Matplotlib-users] Formatting numbers in "nicer" scientific notation

Fri Jun 29 21:31:09 EDT 2018

Hi Daniele,

You might be looking for the MathText-capability of (some of the?)
Matplotlib formatters. See for example:
- https://matplotlib.org/gallery/ticks_and_spines/scalarformatter.html
-
https://matplotlib.org/api/_as_gen/matplotlib.axes.Axes.ticklabel_format.html
Please find attached a small example on how MathText may help to get
where you want (if I have understood your goal correctly).

Another more advanced fashion may be to write your own formatter with
something like FuncFormatter
(https://matplotlib.org/api/ticker_api.html#matplotlib.ticker.FuncFormatter)
but that would definitively be more work...

Hopefully this helps.

Best regards,

On 06/29/2018 05:30 PM, Daniele Nicolodi wrote:
> Hello all,
>
> sorry for the vague title, but I didn't know how else to formulate it.
> I'm looking for a facility to format numbers in a nicer way, namely to
> turno 3.14e-5 into something like $3.14 \times 10^{\minus 5}$.
>
> I'm almost sure I've seen something like that in matplotlib somewhere
> but I'm not able to find it anymore. Is my recollection wrong? Does
> anyone know if that is implemented by some other library?
>
> Thank you. Cheers,
> Dan
> _______________________________________________
> Matplotlib-users mailing list
> Matplotlib-users at python.org
> https://mail.python.org/mailman/listinfo/matplotlib-users
>

-------------- next part --------------
A non-text attachment was scrubbed...
Name: example_mathtext.py
Type: text/x-python
Size: 628 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/matplotlib-users/attachments/20180629/fc88e426/attachment-0001.py>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mathtext_ticker.png
Type: image/png
Size: 16594 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/matplotlib-users/attachments/20180629/fc88e426/attachment-0001.png>