python C matplotlib.pyplot.imshow:在使用属性“sharex”和“sharey”时删除图
here的问题.不同的是,当我绘制通过sharex和sharey属性共享轴的两个子图时,我会在绘图区域内得到不需要的空格.即使设置自动调整(False)后,空格仍然会持续.例如,使
我有一个类似于一个发布的 here的问题.不同的是,当我绘制通过sharex和sharey属性共享轴的两个子图时,我会在绘图区域内得到不需要的空格.即使设置自动调整(False)后,空格仍然会持续.例如,使用与上述帖子的答案相似的代码: import matplotlib.pyplot as plt import numpy as np fig = plt.figure() ax = fig.add_subplot(2,1,1) ax.imshow(np.random.random((10,10))) ax.autoscale(False) ax2 = fig.add_subplot(2,2,sharex=ax,sharey=ax) # adding sharex and sharey ax2.imshow(np.random.random((10,10))) ax2.autoscale(False) plt.show() 导致this图像. 我也按照建议here尝试了ax.set_xlim(0,10)和ax.set_xbound(0,10),但是没有效果.如何摆脱额外的白色空间?任何想法将不胜感激. 解决方法 如建议 here,补充说: ax.set_adjustable('box-forced') ax2.set_adjustable('box-forced')解决问题. (documentation) (编辑:商洛站长网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
- python – matplotlib – 传说在单独的子图
- wpf – Dispatcher与后台线程的区别?
- 深入解析Python中的WSGI接口
- python – 将临时表与SQLAlchemy一起使用
- python – 逐行文件处理,for-loop vs with
- python – 在Matplotlib中绘制两行之间的角度的最佳方式
- python – 为什么skimage.transform.rotate比PIL的Image.ro
- Django 1.10中有哪些django.core.context_processors.reque
- Python:如何在字符串中剪切超过2个相等字符的序列
- python – Flask会话变量在请求之间不存在