在一个画布上绘制的4 个子图,子图以 2 行 2 列的格局显示,子图用 ax 表示,现在需要在每个子图上绘制不同的图,依据数据 data,在第 2 行第 1 列的子图绘制一个折线图,要求线的颜色为红色,marker 为五角星,线条为虚线 dashed line。
A ax[2,1].plot(data,“r--”)
B.ax[1,0].plot(data,”r--”)
C.ax[2,1].plot(data,” r*--")
D.ax[1;0].plot(data,”r--*”)
import matplotlib.pyplot as plt
data = [1, 2, 3, 7, 32, ]
fig, ax = plt.subplots(2, 2)
ax[0, 0].plot(data, 'r--') # 0行0列
ax[0, 1].plot(data, 'b--') # 0行1列
ax[1, 0].plot(data, 'r*--') # 1行0列
ax[1, 1].plot(data, 'b--*') # 1行0列
plt.show()