问题描述
我一直在尝试用不同的颜色填充一组箱形图的框。参见下面的代码。
# Box Plots
fig,axs = plt.subplots(2,2,figsize = (10,10))
plt.subplots_adjust(hspace = .2,wspace = 0.4)
plt.tick_params(axis='x',which='both',bottom=False)
axs[0,0].boxplot(dfcensus["Median Age"],patch_artist=True)
axs[0,0].set_ylabel('Age',fontsize = '12')
axs[0,0].set_title('Median Age',fontsize = '16')
axs[0,0].get_xaxis().set_visible(False)
axs[0,0].set_facecolor('blue')
axs[0,1].boxplot(dfcensus["% Bachelor Degree or Higher"],1].set_ylabel('Percentage',1].set_title('% Bachelor Degree or Higher',1].get_xaxis().set_visible(False)
axs[0,1].set_facecolor('red')
axs[1,0].boxplot(dfcensus["Median Household Income"],patch_artist=True)
axs[1,0].set_ylabel('Dollars',fontsize = '12')
axs[1,0].set_title('Median Household Income',fontsize = '16')
axs[1,0].get_xaxis().set_visible(False)
axs[1,0].set_facecolor('green')
axs[1,1].boxplot(dfcensus["Median Home Value"],1].set_ylabel('Dollars',1].set_title('Median Home Value',1].get_xaxis().set_visible(False)
axs[1,1].set_facecolor=('orange')
plt.show()
代替填充方框图中的方框,而是填充框架。
This is a picture of the output
感谢您的帮助。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)