matplotlib画刻度为对数的图

1. 代码

import matplotlib.pyplot as plt

a = [1000,2000,3000,4000,5000]
a_x = [1, 2, 3, 4, 5]
b = [0.00001,0.00025,0.001,0.005,0.000001]

plt.figure(figsize=(10, 6))
plt.plot(a_x, b, c='red', label='label')
plt.scatter(a_x, b, c='blue')
plt.xlabel('step$(\\times 10^3)$')
plt.ylabel('loss')
plt.yscale('log')
plt.ylim(0.000001, 0.01)
plt.legend()
plt.show()

2. 结果展示

matplotlib画刻度为对数的图_第1张图片

你可能感兴趣的:(Python,matplotlib)