Matplotlib,多面板图上的两个 x 轴标签
Matplotlib, two x-axes labels on multipanel plot
我想制作一个 3 面板图(三个面板垂直堆叠在一起),但有两个 x 轴标签,例如从
here
下方 x 轴和上方 x 轴适用于所有三个面板中的数据。
fig, (ax1, ax2, ax3, ax4) = plt.subplots(4, sharex=True,
gridspec_kw={'height_ratios': [7,0, 7, 3]},
figsize=(14.0, 16.0))
顶部面板是
ax1. and ax2.
和
ax2 = ax1.twiny()
好像不行。
如果要创建 3 个子图,最好不要创建 4 个。
import matplotlib.pyplot as plt
fig, (ax1, ax2, ax3) = plt.subplots(3, sharex=True,
gridspec_kw={'height_ratios': [7, 7, 3]},
figsize=(8, 8))
ax4 = ax1.twiny()
plt.show()
我想制作一个 3 面板图(三个面板垂直堆叠在一起),但有两个 x 轴标签,例如从 here
下方 x 轴和上方 x 轴适用于所有三个面板中的数据。
fig, (ax1, ax2, ax3, ax4) = plt.subplots(4, sharex=True,
gridspec_kw={'height_ratios': [7,0, 7, 3]},
figsize=(14.0, 16.0))
顶部面板是
ax1. and ax2.
和
ax2 = ax1.twiny()
好像不行。
如果要创建 3 个子图,最好不要创建 4 个。
import matplotlib.pyplot as plt
fig, (ax1, ax2, ax3) = plt.subplots(3, sharex=True,
gridspec_kw={'height_ratios': [7, 7, 3]},
figsize=(8, 8))
ax4 = ax1.twiny()
plt.show()