具有多个 2D 数据阵列的 Python xarray 图堆叠直方图

问题描述

我有 3 个 2D(带有高度和月份暗淡)数据数组 y1,y2,y3 用于 3 个不同的年份。我使用此代码创建堆叠直方图

fig = plt.figure()
b=np.linspace(-4,-1.5,20)   

ax1 = fig.add_subplot(111)

a1 = xr.plot.hist(y1,ax=ax1,bins=b,color='b',align='mid',label = '2017',histtype= 'barstacked',stacked = True)
a2 = xr.plot.hist(y2,color='r',label = '2018',stacked = True)
a3 = xr.plot.hist(y3,color='g',label = '2019',stacked = True)
ax1.legend()

我得到了这样的图

fig1

我该如何修改代码才能得到这样的图?

enter image description here

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)