This is a good question, and one that has been around for a while in some 
form, unfortunately; see https://trac.sagemath.org/ticket/7964 for a 
related ticket.   See https://trac.sagemath.org/ticket/30983 for a ticket 
that complains instead about something else but which is closely related.

We would be grateful for any additional insight you might provide.  Here 
are some pieces of info about where we use matplotlib that you might find 
useful in that regard.

We use some specific matplotlib ticker and formatter options which don't 
always play well here. 
 See 
https://github.com/sagemath/sage/blob/develop/src/sage/plot/graphics.py#L2326 
for _matplotlib_tick_formatter in sage/plot/graphics.py

In particular, note that, under ordinary circumstances,

y_locator = MaxNLocator(**locator_options)
y_formatter = ScalarFormatter()

That is very close to the defaults for matplotlib, but maybe we are using 
things in an antiquated way.  See 
e.g. 
https://matplotlib.org/stable/api/ticker_api.html#matplotlib.ticker.ScalarFormatter
 

On the other hand, if (as I suspect) that isn't the root issue, it probably 
is in the save method 
(https://github.com/sagemath/sage/blob/develop/src/sage/plot/graphics.py#L3198).
 
 My first thought was that somehow fig_tight played a role, but 

sage: plot(x^2,(x,0,5000),fig_tight=False)

doesn't seem to be any different than the one you pointed out.  Another 
possibility is tight_layout 
(https://matplotlib.org/stable/api/tight_layout_api.html) which we do use, 
but which a little experimentation doesn't seem to indicate is the problem 
either.
On Tuesday, July 26, 2022 at 5:15:11 AM UTC-4 niran...@gmail.com wrote:

> Dear all,
>     "2D plotting" doc says,
> "Another thing to be aware of with axis labeling is that when the labels 
> have quite different orders of magnitude or are very large, scientific 
> notation (the e  notation for powers of ten) is used."
>
> But display of this multiplier power for the scaled y-axis is missing if 
> the plot starts with x=0 or at most will be missing till the x-axis 
> detaches from the origin. Following examples illustrates it,
>
> *sage:*  plot(x^2,(x,0,5000))  # missing display of 1e7 above y-axis
> *sage:*  plot(x^2,(x,50,5000))  # missing display of 1e7 above y-axis
> *sage:*  plot(x^2,(x,100,5000))  # display of 1e7 above y-axis is visible
>
> On the other side matplotlib natively always displays the scale multiplier 
> (if any) whenever numbers are large. For example:
>
> *sage:*  import matplotlib.pyplot as plt
> *sage:*  import numpy as np
> *sage:*  z = np.linspace(0, 5000, 100)
> *sage:*  plt.plot(z, z**2)
> *sage:*  plt.show()
>
> My other plots involved electric field calculations which had magnitudes 
> around 1/epsilon_0 which is 1/(8.85E-12) =~ 10^11. For those plots starting 
> with x=0 the display of multiplier used for y-axis were missing.
>
> With regards
> Niranjana
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-devel/146eb3ef-49bf-4f06-8e40-3c21c7a67bd5n%40googlegroups.com.

Reply via email to