Python で空の円を含む散布図を作成するにはどうすればよいでしょうか? 質問する

Python で空の円を含む散布図を作成するにはどうすればよいでしょうか? 質問する

Python で Matplotlib を使用して、空の円を含む散布図をプロットするにはどうすればよいでしょうか。目標は、によってすでにプロットされている色付きの円scatter()周囲に空の円を描画して強調表示することです。理想的には、色付きの円を再描画する必要はありません。

試してみましたがfacecolors=None、無駄でした。

ベストアンサー1

scatter のドキュメントから:

Optional kwargs control the Collection properties; in particular:

    edgecolors:
        The string ‘none’ to plot faces with no outlines
    facecolors:
        The string ‘none’ to plot unfilled outlines

次のことを試してください。

import matplotlib.pyplot as plt 
import numpy as np 

x = np.random.randn(60) 
y = np.random.randn(60)

plt.scatter(x, y, s=80, facecolors='none', edgecolors='r')
plt.show()

サンプル画像

注:他の種類のプロットについては、との使用に関するこの投稿を参照してください。markeredgecolormarkerfacecolor

おすすめ記事