【发布时间】:2013-12-18 14:18:27
【问题描述】:
我有下面的代码可以产生所示的情节。
mport matplotlib.pyplot as plt
import matplotlib.gridspec as gridspec
import numpy as np
One = range(1,10)
Two = range(5, 14)
l = len(One)
fig = plt.figure(figsize=(10,6))
gs = gridspec.GridSpec(3, 1, height_ratios=[5, 3, 3])
ax0 = plt.subplot(gs[0])
ax0.bar(range(l), Two)
plt.ylabel("Number of occurrence")
ax1 = plt.subplot(gs[1], sharey=ax0)
ax1.bar(range(l), Two)
ax2 = plt.subplot(gs[2])
ax2.bar(range(l), One)
plt.show()
我希望在第一个和第二个图之间共享 ylabel(“出现次数”),也就是说,它应该出现在第一个和第二个图的中心左侧。我该怎么做?
【问题讨论】:
-
英文更正:你的意思是“出现次数”吗?
标签: python matplotlib