-
Notifications
You must be signed in to change notification settings - Fork 102
Closed
Labels
Description
Description
When the number is large, matplotlib will use e
notation automatically. But, we usually use x10^{}
in science paper.
Steps to reproduce
import proplot as plot
import numpy as np
state = np.random.RandomState(51423)
fig, axs = plot.subplots()
axs.format(ylim=(0, 5e10), ylocator=2e10)
Equivalent steps in matplotlib
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.ticker as mticker
fig, ax = plt.subplots()
x = np.linspace(0, 5e10, 4)
# y = x**2
ax.plot(x)
f = mticker.ScalarFormatter(useOffset=False, useMathText=True)
g = lambda x,pos : "${}$".format(f._formatSciNotation('%1.10e' % x))
plt.gca().yaxis.set_major_formatter(mticker.FuncFormatter(g))
Proplot version
0.5.0