Des*_*wal 3 python matplotlib histogram python-3.x pandas
我正在尝试使用 numpy 数组绘制带有系列的直方图。
n,bins,patch = plt.hist(ser,bins=10, color='green', alpha=0.8, label='Value', edgecolor='orange', linewidth=2)
plt.legend()
plt.ylabel('No of bags', size='x-large')
plt.xlabel('Money in US $', size= 'x-large')
Run Code Online (Sandbox Code Playgroud)
IT 运行良好,但尺寸很小。我尝试使用olt.hist(figsize=(8,8))但它按预期抛出错误。
如何增加直方图的大小?
plt.figure(figsize=(8,8)) #change your figure size as per your desire here
n,bins,patch = plt.hist(ser,bins=10, color='green', alpha=0.8, label='Value', edgecolor='orange', linewidth=2)
....
....
Run Code Online (Sandbox Code Playgroud)
要更改背景颜色和边框颜色:
plt.figure(figsize=(8,8),facecolor='red',edgecolor='blue')
Run Code Online (Sandbox Code Playgroud)