简体   繁体   中英

How to change axis tick label rate in Matplotlib

I have a scatter graph and I would like to change the x and y tick rates. Here is the graph I have:

在此处输入图像描述

As you can see, the x value tick rate increases at a 0.02 rate. I would like to change it to any other value. The same for the y axis.

You can do that by supplying the tick positions you want with plt.xticks and plt.yticks .

For example, for a spacing of 0.05 in x, use

step = 0.05
plt.xticks(np.arange(40.65, 40.85 + step, step))

Same for the y axis. Here, np is numpy .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM