Answers for "how to plot log x using plt.plot"

3

matplotlib y axis log scale

import pylab
import matplotlib.pyplot as plt
a = [pow(10, i) for i in range(10)]
fig = plt.figure()
ax = fig.add_subplot(2, 1, 1)

line, = ax.plot(a, color='blue', lw=2)

ax.set_yscale('log')

pylab.show()
Posted by: Guest on August-23-2020

Python Answers by Framework

Browse Popular Code Answers by Language