PyCharm运行Python代码 import numpy as np import matplotlib matplotlib.use('nbagg') import matplotlib.pyplot as plt np.random.seed(0) x=np.arange(5) y=np.random.randint(-5,5,5) print(y) fig,axes = plt.subplots(ncols = 2) v_bars = axes[0].bar(x,y,color = 'red') h_bars = axes[1].barh(x,y,color = 'red') axes[0].axhline(0,linewidth=2,color = 'grey') axes[1].axvline(0,linewidth=2,color = 'grey') plt.show()