问题:无法确定 xticks 和 yticks 从提供的列表中缺少几个值的原因 我的代码如下:
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import numpy as np
np.random.seed(1000)
x=np.random.rand(10)
y=np.random.rand(10)
z=np.sqrt(x*2 + y*2)
fig=plt.figure(figsize=(8,6))
axes1=plt.subplot(221, title='Scatter plot with Upper Traingle Markers')
axes1.set_xticks([0.0, 0.4, 0.8, 1.2])
axes1.set_yticks([-0.2, 0.2, 0.6, 1.0])
axes1.scatter(x,y,marker='^',s=[80],c=z,edgecolor='black')
axes2=plt.subplot(222, title='Scatter plot with Plus Markers')
axes2.set_xticks([0.0, 0.4, 0.8, 1.2])
axes2.set_yticks([-0.2, 0.2, 0.6, 1.0])
axes2.scatter(x,y,marker='+',s=[80],c=z,edgecolor='black')
axes3=plt.subplot(223, title='Scatter plot with Circle Markers')
axes3.set_xticks([0.0, 0.4, 0.8, 1.2])
axes3.set_yticks([-0.2, 0.2, 0.6, 1.0])
axes3.scatter(x,y,marker='o',s=[80],c=z,edgecolor='black')
axes4=plt.subplot(224, title='Scatter plot with Diamond Markers')
axes4.set_xticks([0.0, 0.4, 0.8, 1.2])
axes4.set_yticks([-0.2, 0.2, 0.6, 1.0])
axes4.scatter(x,y,marker='d',s=[80],c=z,edgecolor='black')
plt.tight_layout()
plt.show()