「 python3 」 一覧

no image

matplotlib でcsv ファイルを読み込むとき、最初の行をスキップする方法

2021/06/26   -matplotlib, python3
 ,

numpy の loadtxt で読み込む行を省略したい場合 スキップしたい行を # 等の記号でコメントアウトして、 loadtxt の comments = ‘#’ とすると …

no image

matplotlib で、縦横の罫線を引く方法

2021/06/26   -matplotlib, python3
 ,

破線をカスタマイズする方法 以下では、dashes = [5,2,2,2] で、線5・空白2・線2・空白2の破線を指定している。 詳しくは次を参照。 https://matplotlib.org/st …

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 …