我试图重现这个answer,但得到以下错误:
AttributeError:'GrouperView'对象没有属性'join'
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
Cell In[283], line 7
4 flights = flights.pivot("month", "year", "passengers")
5 f,(ax1,ax2,ax3, axcb) = plt.subplots(1,4,
6 gridspec_kw={'width_ratios':[1,1,1,0.08]})
----> 7 ax1.get_shared_y_axes().join(ax2,ax3)
8 g1 = sns.heatmap(flights,cmap="YlGnBu",cbar=False,ax=ax1)
9 g1.set_ylabel('')
AttributeError: 'GrouperView' object has no attribute 'join'
字符串
seaborn版本如下:
print(sns.__version__) #0.13.0
import matplotlib
print('matplotlib: {}'.format(matplotlib.__version__) #matplotlib: 3.8.1)
型
我检查了一些工作,但无法解决图中的问题,因为在打印时没有真实的字符串ax2,ax3
:
即使我降级了seaborn,但没有解决基于此thread的问题
2条答案
按热度按时间dgenwo3n1#
如3.6 API更改中所建议的(并在3.8 API更改中重复),使用
Axes.sharey
。字符串
由于
Axes
只能与另一个Axes
共享sharey
,因此我不知道有一种替代方法可以让ax1
在一个步骤中与ax2
和ax3
共享。0yycz8jy2#
解决方案:请将matplotlib降级到3.7或3.6
你的错误与海运无关,
由于matplotlib,您会收到此错误:
当我将matplotlib升级到
3.8.1
时,我收到这个错误:字符串
此外,我在matplotlib 3.6中收到了弃用警告
MatplotlibDeprecationWarning:联接函数在Matplotlib 3.6中已被弃用,将在两个次要版本之后删除。
我可以在matplotlib 3.6和3.7中复制图形
此处为代码:
型
的数据