【发布时间】:2022-01-08 22:34:21
【问题描述】:
所以有这个指南: http://matplotlib.org/examples/pylab_examples/scatter_symbol.html
# http://matplotlib.org/examples/pylab_examples/scatter_symbol.html
from matplotlib import pyplot as plt
import numpy as np
import matplotlib
x = np.arange(0.0, 50.0, 2.0)
y = x ** 1.3 + np.random.rand(*x.shape) * 30.0
s = np.random.rand(*x.shape) * 800 + 500
plt.scatter(x, y, s, c="g", alpha=0.5, marker=r'$\clubsuit$',
label="Luck")
plt.xlabel("Leprechauns")
plt.ylabel("Gold")
plt.legend(loc=2)
plt.show()
但是如果你像我一样不想使用俱乐部套装标记...
你如何制作自己的标记_________?
更新
我喜欢这种特殊标记类型的地方在于它很容易使用简单的 matplotlib 语法进行调整:
from matplotlib import pyplot as plt
import numpy as np
import matplotlib
x = np.arange(0.0, 50.0, 2.0)
y = x ** 1.3 + np.random.rand(*x.shape) * 30.0
s = np.random.rand(*x.shape) * 800 + 500
plt.plot(x, y, "ro", alpha=0.5, marker=r'$\clubsuit$', markersize=22)
plt.xlabel("Leprechauns")
plt.ylabel("Gold")
plt.show()
【问题讨论】:
-
你看过this吗?
-
是的,我确实有。但这对我没有用。我喜欢 matplotlib 示例代码的地方是 'c="g"',我将其解释为绘图的颜色调整(在编写时没有 python shell 来测试它)。
标签: python matplotlib