1 import
import matplotlib
import matplotlib.pyplot as plt
import numpy as np
2 Data
X = np.arange(0, 12.1, 0.1)
Y = np.sin(X)
3 Plot
plt.plot(X, Y, 'r')
[<matplotlib.lines.Line2D at 0x2284bdd1400>]
![在这里插入图片描述](https://img-blog.csdnimg.cn/d8584d6521ff4914a24b627e7fbc0e55.png#pic_center)
plt.plot(X, Y, '--')
[<matplotlib.lines.Line2D at 0x228558e9400>]
![在这里插入图片描述](https://img-blog.csdnimg.cn/182d815a2b804b63817389b9390f8172.png#pic_center)
plt.plot(X, Y, 'r:')
[<matplotlib.lines.Line2D at 0x2284d23bac0>]
![在这里插入图片描述](https://img-blog.csdnimg.cn/6acc23a58c3148a1826327839b5dfa37.png#pic_center)
plt.plot(X, Y, 'r-.')
[<matplotlib.lines.Line2D at 0x2284d2b11c0>]
![在这里插入图片描述](https://img-blog.csdnimg.cn/a15a0b366800402dad7cd57ebaa66e34.png#pic_center)
plt.plot(X, Y, color='lime', linestyle='-.')
[<matplotlib.lines.Line2D at 0x2284d316820>]
![在这里插入图片描述](https://img-blog.csdnimg.cn/7204fba8ebfb40858a756142df778e41.png#pic_center)
''' color 线颜色, linestyle 线性状, linewidth 线粗细, marker 标志性状,
markerfacecolor 标志颜色, markeredgecolor 标志边缘颜色, markersize 标志大小,
markerdegewidth 标志边缘大小
'''
plt.plot(X, Y, color='lime', linestyle='-', linewidth=2, \
marker='v', markerfacecolor='black', markeredgecolor='red',\
markersize=3, markeredgewidth=1)
[<matplotlib.lines.Line2D at 0x22857689850>]
![在这里插入图片描述](https://img-blog.csdnimg.cn/763d3657b3f2444ebcc1b3df5664fd3b.png#pic_center)
plt.scatter(X, Y)
<matplotlib.collections.PathCollection at 0x228577a2520>
![在这里插入图片描述](https://img-blog.csdnimg.cn/1922530c5742478db9d273f565f7de1c.png#pic_center)
fig = plt.figure(figsize=(8, 4))
plt.plot(X, Y, color='lime', linestyle='-', linewidth=2, \
marker='v', markerfacecolor='black', markeredgecolor='red',\
markersize=3, markeredgewidth=1, label='Normal case', zorder=2)
ax1 = plt.gca()
ax1.set_title('Big Title', fontname='Arial', fontsize=20, weight='bold', style='italic')
ax1.set_xlabel('time (UTC)')
ax1.set_ylabel('T($^o$C)')
ax1.set_xticks([0, 2.5, 7, 11])
ax1.set_xticklabels(['J', 'A', 'N', 'E'])
ax1.tick_params(axis='both', direction='in', color='blue', \
length=10, width=3)
plt.plot(X+2, Y, linewidth=3, label='Strange', zorder=1)
plt.legend(loc='best')
plt.tight_layout()
plt.savefig('./Big Title.png', dpi=400)
![在这里插入图片描述](https://img-blog.csdnimg.cn/cfed70712031411bab78b92f92e91f6e.png#pic_center)
fig, ax = plt.subplots(3, 1)
ax[1].plot(X, Y)
ax[0].plot(X, Y, 'r')
ax[0].set_xlim([0, 10])
ax[2].set_xlim([0, 10])
ax[2].set_yscale('log')
ax2 = ax[2].twinx()
ax2.plot(X, Y, 'ro')
ax3 = ax2.twiny()
ax3.plot(X, Y, 'ro')
[<matplotlib.lines.Line2D at 0x2285a8abbe0>]
![在这里插入图片描述](https://img-blog.csdnimg.cn/7aa1dc250a0f49bebee914d61201585a.png#pic_center)