减少绘图刻度数 [英] reducing number of plot ticks

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

问题描述

我的图表上有太多的勾号,而且它们相互碰撞.

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

如何减少滴答声?

例如,我有刻度:

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天全站免登陆