![](/img/trans.png)
[英]Matplotlib makes empty plot using plt.plot but shows the plot using plt.scatter
[英]Matplotlib Plot Dashed Circles (using plt.plot instead of plt.scatter)
給定以下內容:
import matplotlib.pyplot as plt
import numpy as np
#http://matplotlib.org/api/pyplot_api.html#matplotlib.pyplot.scatter
x = np.random.randn(60)
y = np.random.randn(60)
x2 = np.random.randn(60)
y2 = np.random.randn(60)
plt.plot(x, y, marker='o', markeredgecolor='r', linestyle='none', markerfacecolor='none')
plt.plot(x2, y2, marker='o', markeredgecolor='r', linestyle='none', markerfacecolor='none')
plt.show()
我希望將x2和y2繪制為虛線(甚至虛線)圓圈。 我避免使用plt.scatter,因為腳本的其余部分可以更好地與plt.plot一起使用。 這是我在尋找的東西:
提前致謝!
僅供參考:這是我創建的實際圖表。 我現在僅使用六邊形來表示不同的數據(未來數據)。
自定義圖例和對熊貓數據框中的行組進行繪圖增加了plt.scatter無法克服的復雜性層。
您可以使用mathtext功能使用STIX字體( 此處帶有所有符號的pdf)中的STIX字體中的虛線圓( ur'$\◌$'
)
plt.plot(x, y, marker=ur'$\u25CC$', markerfacecolor='r',
markeredgecolor='r', markersize=30, linestyle='none', )
注意, markerfacecolor
也設置為一種顏色。
缺點是它們需要一定的大小才能與封閉的圓區分開。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.