python matplot画图

来源:互联网 发布:单片机串口引脚 编辑:程序博客网 时间:2024/06/06 01:43

import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
fig = plt.figure()
ax = fig.add_subplot(2,2,1)
ax.plot(np.random.rand(100))
ticks = ax.set_xticks([0,25,50,75])
labels = ax.set_xticklabels([‘one’,’two’,’three’,’four’])
ax.set_xlabel(‘Stage’)
plt.show()

import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
fig = plt.figure()
ax = fig.add_subplot(2,2,1)
ax.plot(np.random.rand(10),’k-‘,label=’two’)
ticks = ax.set_xticks([0,25,50,75])
labels = ax.set_xticklabels([‘one’,’two’,’three’,’four’])
ax.set_xlabel(‘Stage’)
ax.legend(loc = ‘best’)
plt.show()