User Tools

Site Tools


python:matplotlib:基本的な使い方

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
python:matplotlib:基本的な使い方 [2018/01/21 01:29]
koudai [初めてのプロット]
python:matplotlib:基本的な使い方 [2021/06/27 22:04] (current)
Line 29: Line 29:
 {{:python:matplotlib:intro1.png?direct&400|}} {{:python:matplotlib:intro1.png?direct&400|}}
  
-保存するにはグラフが表示されたウィンドウの上の方にあるフロッピーディスクのマークをクリックします(Ctrlキーを押しながらsを押すのでも可)。+保存するにはグラフが表示されたウィンドウの上の方にあるフロッピーディスクのマークをクリックします([Ctrl-s]も可)。
  
  
Line 44: Line 44:
 y1 = np.sin(x) y1 = np.sin(x)
 y2 = np.cos(x) y2 = np.cos(x)
- 
-plt.title("graph") 
-plt.xlabel("x") 
-plt.ylabel("y") 
- 
-plt.plot(x, y1, label="sin x") 
-plt.plot(x, y2, label="cos x") 
-plt.legend() 
  
 plt.xlim(-np.pi, np.pi)   # x軸は-πからπまで plt.xlim(-np.pi, np.pi)   # x軸は-πからπまで
Line 75: Line 67:
 x = np.arange(-5, 5, 0.1) x = np.arange(-5, 5, 0.1)
 y = np.sin(x) y = np.sin(x)
 +
 plt.title("graph"  # グラフのタイトル plt.title("graph"  # グラフのタイトル
 plt.xlabel("x"     # x軸(横軸)のラベル plt.xlabel("x"     # x軸(横軸)のラベル
python/matplotlib/基本的な使い方.1516465753.txt.gz · Last modified: 2021/06/27 21:59 (external edit)