「 matplotlib 」 一覧

no image

matplotlib で、複数のグラフを簡単にプロットする方法

2021/07/03   -matplotlib, python3
 ,

変数を並べて書くと、次のように自動的に順番を理解してグラフを表示してくれる。 例 import numpy as np from matplotlib import pyplot as plt fro …

no image

matplotlib で、粗い刻みと細かい刻みの目盛りを表示する方法

2021/06/28   -matplotlib, python3
 ,

set_major_locator で粗い刻みの目盛りを調整する。 set_minor_locator で、細かい刻みの目盛りを調整する。 以下の例で set_major_formatter は、表示 …

no image

matplotlib の ax でx軸、y軸の端の値を設定する

2021/06/28   -matplotlib, python3
 ,

axes には、set_xlim として定義する。 例 import numpy as np from matplotlib import pyplot as plt x = np.linspace( …

no image

matplotlib で、x,y の軸上の数値を表示する方法

2021/06/28   -matplotlib, python3
 ,

ax の xtics と ytics を使って表示する。 詳細は次のドキュメントを参照。 https://matplotlib.org/stable/gallery/lines_bars_and_ma …

no image

matplotlib でエラーバーを設定する方法

2021/06/28   -matplotlib, python3
 ,

pyplot.errorbar を使って設定する。 オプションの詳細は https://matplotlib.org/stable/api/_as_gen/matplotlib.pyplot.erro …

no image

matplotlib で、グラフのタイトルに上付き文字を入力する方法

2021/06/28   -matplotlib, python3
 ,

数学記号などで、グラフのタイトルに上付きの文字を入力したい場合がある。 その場合は次のように書いて設定できる。 例 import numpy as np from matplotlib import …

no image

matplotlib でグラフ表示ウィンドウの画面上の位置を自由に設定する方法

2021/06/28   -matplotlib, python3
 ,

matplotlib.use(‘TkAgg’) としておき、 get_current_fig_manager().window.wm_geometry(“+20+50”) として、(+20+50)のと …

no image

matplotlib で2種類のcsvファイルをプロットする方法

2021/06/26   -matplotlib, python3
 ,

data1.csv と、data2.csv の2つのファイルを散布図としてプロットするには次のようにする。 例 import numpy as np from matplotlib import py …

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 …