放置子图行左侧的子图标题

时间:2018-06-18 09:56:22

标签: python-3.x matplotlib

当放置在x * 2子图的网格中时,是否可以将子图的标题放在图的左侧?这些图共享x轴,并且两个方向放置,因为它们代表两个方向上道路的交通计数。布局的想法:enter image description here

将子图放置为找到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')

1 个答案:

答案 0 :(得分:0)

似乎没有直接的方法来做到这一点。我相信你最好的选择是plt.text()