python:matplotlib:目盛りの設定
Differences
This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| python:matplotlib:目盛りの設定 [2018/01/24 21:25] – 作成 koudai | python:matplotlib:目盛りの設定 [2021/06/27 22:04] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 22: | Line 22: | ||
| plt.show() | plt.show() | ||
| - | < | + | </file> |
| {{: | {{: | ||
| - | 上の例では数字を直接入力しましたが、np.arrangeとplt.xlimを組み合わせて使うのが便利です。 | + | 上の例では目盛りの数字をすべて直接入力しましたが、np.arangeとplt.xlim,plt.ylimを組み合わせて使うのが便利です。 |
| <file python> | <file python> | ||
| Line 36: | Line 36: | ||
| plt.plot(x, y) | plt.plot(x, y) | ||
| - | |||
| - | plt.xticks([-6, | ||
| - | plt.yticks([-1.5, | ||
| plt.xticks(np.arange(-6, | plt.xticks(np.arange(-6, | ||
| Line 53: | Line 50: | ||
| ====== 目盛りの幅と長さ ====== | ====== 目盛りの幅と長さ ====== | ||
| - | tick_paramで指定できます。 | + | 目盛りの幅と長さtick_paramsで指定できます。 |
| - | 幅と長さはそれぞれwidthとlengthで指定します。 | + | それぞれwidthとlengthで指定します。 |
| <file python> | <file python> | ||
| Line 64: | Line 61: | ||
| plt.plot(x, y) | plt.plot(x, y) | ||
| - | |||
| - | plt.xticks([-6, | ||
| - | plt.yticks([-1.5, | ||
| - | |||
| - | plt.xticks(np.arange(-6, | ||
| - | plt.yticks(np.arange(-1.5, | ||
| - | |||
| - | plt.xlim(-5, | ||
| - | plt.ylim(-1.2, | ||
| plt.tick_params(width = 2, length = 10) | plt.tick_params(width = 2, length = 10) | ||
| Line 98: | Line 86: | ||
| plt.plot(x, y) | plt.plot(x, y) | ||
| - | |||
| - | plt.xticks([-6, | ||
| - | plt.yticks([-1.5, | ||
| - | |||
| - | plt.xticks(np.arange(-6, | ||
| - | plt.yticks(np.arange(-1.5, | ||
| - | |||
| - | plt.xlim(-5, | ||
| - | plt.ylim(-1.2, | ||
| plt.show() | plt.show() | ||
| </ | </ | ||
python/matplotlib/目盛りの設定.1516796748.txt.gz · Last modified: 2021/06/27 21:59 (external edit)
