减少点滴答声的数量 [英] reducing number of plot ticks

查看:123
本文介绍了减少点滴答声的数量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的图表上的刻度线太多,它们彼此碰到了.

I have too many ticks on my graph and they are running into each other.

如何减少刻度线数量?

How can I reduce the number of ticks?

例如,我打勾:

1E-6, 1E-5, 1E-4, ... 1E6, 1E7

我只想要:

1E-5, 1E-3, ... 1E5, 1E7

我尝试过使用LogLocator,但是我无法弄清楚.

I've tried playing with the LogLocator, but I haven't been able to figure this out.

推荐答案

或者,如果您想简单地设置刻度线的数量,同时允许matplotlib放置刻度线(当前仅使用MaxNLocator),则有 pyplot.locator_params

Alternatively, if you want to simply set the number of ticks while allowing matplotlib to position them (currently only with MaxNLocator), there is pyplot.locator_params,

pyplot.locator_params(nbins=4)

您可以按照以下方法在此方法中指定特定的轴,默认值是两个:

You can specify specific axis in this method as mentioned below, default is both:

# To specify the number of ticks on both or any single axes
pyplot.locator_params(axis='y', nbins=6)
pyplot.locator_params(axis='x', nbins=10)

这篇关于减少点滴答声的数量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆