Home > Back-end >  How to re-use the return values of matplotlib.Axes.hist?
How to re-use the return values of matplotlib.Axes.hist?

Time:02-02

Suppose I want to plot a histogram of the same data twice:

import matplotlib.pyplot as plt

fig = plt.figure(figsize=(8,6))
ax1,ax2 = fig.subplots(nrows=2,ncols=1)
ax1.hist(foo)
ax2.hist(foo)
ax2.set_yscale("log")
ax2.set_xlabel("foo")
fig.show()

Note that I call


  •  Tags:  
  • Related