User Tools

Site Tools


python:matplotlib:線種の設定

Differences

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

Link to this comparison view

python:matplotlib:線種の設定 [2018/01/22 18:06]
koudai 作成
python:matplotlib:線種の設定 [2021/06/27 22:04]
Line 1: Line 1:
-====== 概要 ====== 
- 
-matplotlibのラインやポイントをいろいろ変更します。 
- 
- 
- 
-====== ラインの種類 ====== 
- 
-<file python lines.py> 
-import numpy as np 
-import matplotlib.pyplot as plt 
- 
-x = np.arange(-5, 5, 0.1) 
-y = np.sin(x) 
- 
-plt.plot(x,     y, "-",  label="-") 
-plt.plot(x+0.2, y, "--", label="--") 
-plt.plot(x+0.4, y, "-.", label="-.") 
-plt.plot(x+0.6, y, ":",  label=":") 
- 
-plt.legend() 
- 
-plt.xlim(-np.pi, np.pi) 
- 
-plt.savefig("lines.png") 
-</file> 
- 
- 
-====== ポイントの種類 ====== 
- 
-<file python points.py> 
-import numpy as np 
-import matplotlib.pyplot as plt 
- 
-x = np.arange(0, 50, 0.5) 
- 
-plt.plot(x, x, ".", label=".") 
-plt.plot(x+1, x, ",", label=",") 
-plt.plot(x+2, x, "o", label="o") 
-plt.plot(x+3, x, "^", label="^") 
-plt.plot(x+4, x, "v", label="v") 
-plt.plot(x+5, x, "<", label="<") 
-plt.plot(x+6, x, ">", label=">") 
-plt.plot(x+7, x, "s", label="s") 
-plt.plot(x+8, x, "+", label="+") 
-plt.plot(x+9, x, "x", label="x") 
-plt.plot(x+10, x, "D", label="D") 
-plt.plot(x+11, x, "d", label="d") 
-plt.plot(x+12, x, "1", label="1") 
-plt.plot(x+13, x, "2", label="2") 
-plt.plot(x+14, x, "3", label="3") 
-plt.plot(x+15, x, "4", label="4") 
-plt.plot(x+16, x, "h", label="5") 
-plt.plot(x+17, x, "H", label="6") 
-plt.plot(x+18, x, "p", label="p") 
-plt.plot(x+19, x, "|", label="|") 
-plt.plot(x+20, x, "_", label="_") 
- 
-plt.legend(fontsize=8) 
- 
-plt.xlim(0, 30) 
-plt.ylim(0, 10) 
- 
-plt.savefig("points.png") 
-</file> 
  
python/matplotlib/線種の設定.txt · Last modified: 2021/06/27 22:04 (external edit)