AttributeError:Seaborn点图的未知属性y

时间:2019-06-14 07:15:49

标签: python seaborn

即使我也得到了结果,我也收到了此错误。以下是我的数据集

   State Station Code  Week  Score
   Karnataka         BIDE    18   8.32
   Karnataka         BIDD    18   8.01
   Karnataka         PUTD    18   7.62
   Karnataka         TKMD    18   7.39
  Tamil nadu         HSRD    18   8.40
  Tamil nadu         KJMD    18   8.40
  Andra pradesh      NZVD    19   8.19
  Andra pradesh      PKSD    19   8.37
  Andra pradesh      VGAF    19   8.47
  Andra pradesh      SKMI    19   7.11
  Andra pradesh      MRGA    19   7.17
   Karnataka         BIDD    19   8.21
   Karnataka         PUTD    19   8.09
   Karnataka         HSSD    19   8.11
  Andra pradesh      RJAD    20   8.25
  Andra pradesh      SKMI    20   8.33
  Andra pradesh      MRGA    20   7.26
   Karnataka         MDKD    20   6.80
   Karnataka         BIDD    20   8.45
   Karnataka         PUTD    20   7.92
   Karnataka         TKMD    20   7.74
   Karnataka         HSSD    20   8.26
KN = Lower.loc[data['State']=='Karnataka']
fig,ax1 = plt.subplots(figsize=(15,10))
sn.pointplot(x=KN['Week'],y=KN['Score'],hue=KN['Station Code'],data=KN,join=True,ax=ax1)
ax1.set(x="Week",y="Scores",title="Lower Score by Station Wise in KN",label='big')

我得到了我需要的图形,但是它说了意外的特性y,当我加盖Y时,它说了意外的特性x。如果我同时将x和y都设置为上限,则会再次表示意外属性y。

1 个答案:

答案 0 :(得分:0)

我认为您正在尝试设置xlabel和ylabel,因为您需要使用“ xlabel”和“ ylabel”而不是“ x”和“ y”。

ax1.set(xlabel="Week",ylabel="Scores",title="Lower Score by Station Wise in KN",label='big')