簡體   English   中英

如何用標記“ o”繪制點並通過半徑指定​​大小?

[英]How to plot a point with marker 'o' and specify size by Radius?

我試圖通過繪制點

for i in points:
   plt.plot(i[0], i[1], marker = 'o', markersize = size)

有沒有辦法通過Radius指定markersize 例如,如果我想使用上述方法繪制具有特定半徑的圓。

提前致謝。

您可以添加其他號碼,您的半徑中的每個點points

points = [[1,2,10], [2,3,20], [4,2.5,30]]
for i in points:
    plt.plot(i[0], i[1], marker = 'o', markersize = i[2])

另一種更合適的方法是使用字典:

circles = [
    {'r': 10, 'points': [1,2]},
    {'r': 20, 'points': [2,3]},
    {'r': 30, 'points': [4,2.5]}
]

for circle in circles:
    plt.plot(circle['points'][0], circle['points'][1], marker = 'o', markersize = circle['r'])

在此處輸入圖片說明

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM