matplotlib设置共享轴 [英] matplotlib set shared axis

查看:220
本文介绍了matplotlib设置共享轴的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用matplotlib,似乎唯一设置sharexsharey轴参数的时间是在创建子图(add_subplot()subplot()subplots())期间.对于axes类,有一些用于获取轴共享的方法(get_shared_x_axes()get_shared_y_axes()),但是没有用于设置共享的相应方法.也许这是对API的监督,或者可能在体系结构上不合适.

Using matplotlib, it seems the only time to set the sharex or sharey axis parameters are during sub_plot creation (add_subplot(), subplot(), subplots()). For an axes class there are methods for getting axis sharing (get_shared_x_axes(), get_shared_y_axes()), but no corresponding methods for setting sharing. Maybe this is an API oversight, or perhaps it did not fit architecturally.

是否可以更改共享轴参数?

Is there a way to change the shared axis parameter?

对于那些问为什么的人:我正在动态使用绘图矩阵,并且可以使用视图限制来控制它,但是似乎有一种更简单的方法,打开/关闭共享以及使用自动缩放功能会很容易.它.

For those that ask why: I'm using a matrix of plots dynamically, and can control this using view limits, but it just seems like there could be an easier way, and turning sharing on/off and using autoscale would be it.

谢谢.

推荐答案

答案是,设置共享轴的方式是共享两个轴的某些内部状态.正确设置起来有点棘手,并且库中尚不存在即时执行代码(链接和取消链接)的过程.

The answer is that the way shared axes are set up is to share some of the internal state of the two axes. It is a tad tricky to get right and the code to do it on-the-fly (both linking and unlinking) doesn't exist in the library yet.

有关未链接轴上正在进行的工作,请参见 PR .帮助测试和开发此功能将不胜感激.

See this PR for work on-going work on un-linking axes. Help testing and developing this feature would be appreciated.

这篇关于matplotlib设置共享轴的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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