「 matplotlib 」 一覧

no image

matplotlib でグラフの背景の色を変える方法(facecolor)

2021/06/26   -matplotlib, python3
 ,

次のように、axes で facecolor を変更すればよい。 例 from matplotlib import pyplot as plt x = [2,7,8] y = [7,1 …

no image

matplotlib で散布グラフを描く方法

2021/06/25   -matplotlib, python3
 ,

pyplt.scatter を使って散布グラフを描くことができる。 点の色は、点ごとに変えることができる。 下の例では color の配列で点の色を指定している。 例 from matplotlib …

no image

matplotlib で、ヒストグラムを作成する方法

2021/06/25   -matplotlib, python3
 ,

ヒストグラムを描くには、data_hist を使う。 ヒストグラムの縦棒の数は bins で指定する。 例 from matplotlib import pyplot as plt data_hist …

no image

matplotlib で折れ線グラフの下部に色をつけて塗りつぶす方法

2021/06/25   -matplotlib, python3
 ,

pyplot の fill_between を使う。 例 from matplotlib import pyplot as plt data_x = [25,26,27] data_y = & …

no image

matplotlib で csv ファイルからデータを読み込んでグラフを表示する方法

2021/06/24   -matplotlib, python3
 ,

np loadtext で csv ファイルを読み込む。 pyplot.bar で棒グラフを表示する。 例 import numpy as np from matplotlib import pypl …

no image

matplotlib で、線の種類を変更する方法

2021/06/24   -matplotlib, python3
 ,

「linestyle = 」として、線の種類を指定することができる設定の詳細は、次のリンクを参照。 https://matplotlib.org/stable/gallery/lines_bars_a …

no image

matplotlib で、縦横の線(グリッド)を描く方法

2021/06/11   -matplotlib, python3
 ,

pyplot grid で縦横線(罫線のようなもの)を引くことができる。 例 from matplotlib import pyplot as plt data_x = [25,26,27] …

no image

matplotlib で、凡例を表示する方法

2021/06/11   -matplotlib, python3
 ,

データに label を関連付け、plt.legend() で凡例を表示する。 例 from matplotlib import pyplot as plt data_x = [25,26,2 …

no image

matplotlib で、グラフの線の幅を変更する方法

2021/06/11   -matplotlib, python3
 ,

lw で、線幅を数字で指定すればよい。 例 from matplotlib import pyplot as plt data_x = [25,26,27] data_y = [39, …

no image

matplotlib で、グラフの点の見た目を変更する方法

2021/06/11   -matplotlib, python3
 ,

「marker」で指定すればよい。 次のページを参考に、plotの「marker」を変更する。 https://matplotlib.org/stable/api/markers_api.html 例 …