有没有办法改变点的大小、颜色和形状?

Is there a way to change the size, color and shape of a point?

有没有机会我可以更改点的颜色和大小并使它们看起来像这样:○ python?

我现在的代码是:

import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt

# DATA
L = 0.1 #m, length of arm of cross
t = L/2 #m, thickness

# VECTORS OF COORDINATES OF THE CROSS
X = np.array([L, t/2, t/2, -t/2, -t/2, -L, -L, -t/2, -t/2, t/2, t/2, L, L])
Y = np.array([t/2, t/2, L, L, t/2, t/2, -t/2, -t/2, -L, -L, -t/2, -t/2, t/2])

# PLOT
fig, ax = plt.subplots(figsize=(8,8))
ax.plot(X,Y,color='C1', linewidth=2.5)
ax.axis('equal')

point_x = [L - t/2, -L + t/2, 0, 0]
point_y = [0, 0, L-t/2, -L + t/2]

points = ax.scatter(point_x, point_y)
axis_off = ax.axis('off')

看起来像:

我正在考虑改变两端蓝点的颜色大小和形状,谢谢!

如果您将 scatter 更改为 plot,您在标记大小上有更大的自由度:

points = ax.plot(point_x, point_y, ".", ms=50)

另外,您可以从这里选择标记形状: https://matplotlib.org/stable/api/markers_api.html#module-matplotlib.markers.

scatter 中,您可以通过参数 s 更改大小,通过 c 更改颜色,通过 marker 更改形状。如果我没理解错,你想要空心圆作为标记,可以这样获取:

points = ax.scatter(point_x, point_y, facecolors='none', edgecolors='red', s=200)