How to produce an exponentially scaled axis?

后端 未结 2 1005
轮回少年
轮回少年 2021-01-18 05:34

Consider the following code:

from numpy import log2
import matplotlib.pyplot as plt

xdata = [log2(x)*(10/log2(10)) for x in range(1,11)]
ydata = range(10)
p         


        
2条回答
  •  自闭症患者
    2021-01-18 06:20

    The easiest way is to use semilogy

    from numpy import log2
    import matplotlib.pyplot as plt
    
    xdata = log2(range(1,11)) * (10/log2(10))
    ydata = range(10)
    plt.semilogy(xdata, ydata)
    plt.show()
    

    enter image description here

提交回复
热议问题