I'm not sure if I understand your question correctly, but do you want something like this?
import matplotlib.pyplot as plt
import numpy as np
plt.plot(np.logspace(1,10,10),np.logspace(1,5,10))
ax = plt.gca()
ax.get_xaxis().set_major_formatter(plt.LogFormatter(10, labelOnlyBase=False))
ax.get_yaxis().set_major_formatter(plt.LogFormatter(10, labelOnlyBase=False))
which gives
Update:
The approach shown above only works if the data range is big enough. If the scientific notation is wanted for a smaller range a custom Formatter can be used as
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.ticker import FuncFormatter
def MyFormatter(x,lim):
if x == 0:
return 0
return '{0:.2f}e{1:.2f}'.format(np.sign(x)*10**(-np.floor(np.log10(abs(x)))+np.log10(abs(x))),np.floor(np.log10(abs(x))))
#The first argument of the format gives the first significant digits of the number with the sign preserved and brought to a range between [1-10), The next argument gives the numbers integer exponent of 10
#Both the first and second arguments are formatted to display only 2 decimal places due to the lack of space.
majorFormatter = FuncFormatter(MyFormatter)
t = np.arange(0.0, 100.0, 0.1)
s = np.sin(0.1*np.pi*t)*np.exp(-t*0.01)
fig, ax = plt.subplots()
plt.plot(t,s)
ax.xaxis.set_major_formatter(majorFormatter)
This gives a plot like
