使用 matplotlib 绘图时如何更改单个标记

How to change individual markers when plotting with matplotlib

我有下面的代码,我正在尝试弄清楚如何在 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()
import numpy as np
import matplotlib.pyplot as plt

RedLineNames = np.array(["Tub Gallery","Maul Gallery","Rocket Gallery","ClasseArt Gallery ","Wiseworlds Gallery"])
RLC = np.array([[3950, 4250], [1350,450], [3550, 3200], [2500, 2500], [400, 2750]])

# create the figure and axes; use the object oriented approach
fig, ax = plt.subplots(figsize=(8, 6))

# draw the line plot
ax.plot(RLC[:,0], RLC[:,1], color='red')

# set the first two markers separately (black circle and blue square)
ax.plot(RLC[0, 0], RLC[0, 1], 'ok', RLC[1, 0], RLC[1, 1], 'sb')

# set the rest of the markers (green triangle)
ax.plot(RLC[2:, 0], RLC[2:, 1], '^g')

# Add plot names
for i in range(len(RLC)):
    ax.text(RLC[i,0], RLC[i,1]+20, RedLineNames[i])
    
ax.set_title('Map')

ax.invert_yaxis()
    
plt.show()