Jer*_*oen 5 matplotlib python-3.x
当放置在 x*2 子图的网格中时,是否可以将子图的标题放在图的左侧?这些图共享 x 轴,并两两放置,因为它们代表两个方向道路的交通量。布局思路:
子图的放置如下所示:
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')
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
4436 次 |
| 最近记录: |