admin 管理员组文章数量: 1184232
双子图共享Y轴:
import matplotlib.pyplot as plt
import numpy as np
# First create some toy data:
x = np.linspace(0, 2*np.pi, 400)
y = np.sin(x**2)
# Create two subplots and unpack the output array immediately
f, (ax1, ax2) = plt.subplots(1, 2, sharey=True)
ax1.plot(x, y)
ax1.set_title('Sharing Y axis')
ax2.scatter(x, y)
多子图共享X轴:
# Share a X axis with each column of subplots
plt.subplots(2, 2, sharex='col')
多子图共享Y轴:
# Share a Y axis with each row of subplots
plt.subplots(2, 2, sharey='row')
多子图共享X-Y轴:
# Share both X and Y axes with all subplots
plt.subplots(2, 2, sharex='all', sharey='all')
或者:
# Note that this is the same as
plt.subplots(2, 2, sharex=True, sharey=True)
版权声明:本文标题:python多子图坐标轴共享 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.roclinux.cn/b/1754580688a3017061.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论