LoginSignup
8

More than 5 years have passed since last update.

matplotlibでグラフの目盛りの小数点以下を省略する

Posted at

デモ

Before(小数表示) After(整数表示)
dec.png int.png

方法

Locatorを1に変更する。

from matplotlib.ticker import *
ax = plt.gca()
ax.yaxis.set_major_locator(MultipleLocator(1))  # x軸の場合は yaxis -> xaxis

参考

matplotlib - memoring
http://seesaawiki.jp/met-python/d/matplotlib#content_9_31_4

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
8