The function f(x) = 10x is an exponential function, so if you just draw it, it looks like a curve, but you want to draw it in a straight line as if you logged it.
xI've tried, but this is the limit I can make.It's too hard
Is there a shorter and simpler way to do it like 'scale=linear'
?
from pylab import *
import matplotlib.pyplot as pyplot
a = [ pow(10,i) for i in range(10) ]
fig = pyplot.figure()
ax = fig.add_subplot(2,1,1)
line, = ax.plot(a, color='blue', lw=2)
show()
First of all, I'd like to say that I don't recommend using both Pilab and Pyplot. If you want to use a pilot, use a pilot
So, to get to the point, you want to decide on the y-axis.
Then matplotlib.Use pyplot.yscale (*args, **kwargs).
A function used to determine the scale on the y-axis.
Simply put, the factor scale
is
You can choose from among them.
from matplotlib import pyplot
a = [power(10,i) for i in range(10)] #same
pyplot.subplot(2,1,1) #same
pyplot.plot(a, color='blue', lw=2)
pyplot.yscale('log')
pyplot.show()
© 2024 OneMinuteCode. All rights reserved.