【发布时间】:2018-11-27 03:31:00
【问题描述】:
当放置在 x*2 个子图的网格中时,是否可以将子图的标题放在图的左侧?这些图共享 x 轴,并以 2×2 的方式放置,因为它们表示两个方向的道路交通量。布局思路:
按照here 放置子图:
import matplotlib.pyplot as plt
import numpy as np
# Simple data to display in various forms
x = np.linspace(0, 2 * np.pi, 400)
y = np.sin(x ** 2)
# row and column sharing
f, ((ax1, ax2), (ax3, ax4)) = plt.subplots(2, 2, sharex='col', sharey='row')
ax1.plot(x, y)
ax1.set_title('Sharing x per column, y per row')
ax2.scatter(x, y)
ax3.scatter(x, 2 * y ** 2 - 1, color='r')
ax4.plot(x, 2 * y ** 2 - 1, color='r')
【问题讨论】:
标签: python-3.x matplotlib