Derp
Derp

Reputation: 143

Matplotlib error when stacking two bar plots

I am trying to plot two bar plots together, one drawn above the other. However, when I make the call to create the graphs, I am getting the error:

"TypeError: inner() got multiple values for argument 'ax'"

fig, axes = plt.subplots(nrows=2, ncols=1, figsize = (8,4))
plt.bar(range(len(pmfList)), pmfList, ax = axes[0])
plt.bar(range(len(uList)), uList, ax = axes[1])
plt.show()

Am I passing something in wrong? This issue only occurs when I using the axes- they graph fine individually.

Upvotes: 0

Views: 1137

Answers (1)

ImportanceOfBeingErnest
ImportanceOfBeingErnest

Reputation: 339430

plt.bar does not have an ax keyword argument.

In order to plot to different axes,

fig, axes = plt.subplots(nrows=2, ncols=1, figsize = (8,4))
axes[0].bar(range(len(pmfList)), pmfList)
axes[1].bar(range(len(uList)), uList)
plt.show()

Upvotes: 1

Related Questions