我有下面的代码,正在尝试找出如何在matplotlib数组中塑造标记的形状。具体而言,阵列中的第一个标记点应为圆形,阵列中的第二个标记点应为正方形
import matplotlib.pyplot as plt
import numpy as np
plt.title('Map')
plt.gca().invert_yaxis()
RedLineNames = np.array(["Tub Gallery","Maul Gallery","Rocket Gallery","ClasseArt Gallery ","Wiseworlds Gallery"])
RedLineCoords = np.array([[3950, 4250],[1350,450],[3550, 3200],[2500, 2500],[400, 2750]])
# Set marker points
plt.plot(RedLineCoords[:,0],RedLineCoords[:,1],marker='^',markersize=10,color='red')
# Draw connecting red line
plt.plot(RedLineCoords[:,0],RedLineCoords[:,1], 'r-')
# Add plot names
for i in range(len(RedLineCoords)):
plt.text(RedLineCoords[i,0],RedLineCoords[i,1]+20,RedLineNames[i])
plt.show()
相关问题 更多 >
编程相关推荐