0
figures,data= plt.subplots(1,3,figsize=[10,10])

data[0].scatter(columns[3],columns[2])

data[1].hist2d(columns[3],columns[2],cmap='Blues') 

data[2].sns.kdeplot(columns[3],columns[2],cmap='Blues')

gives the error: 'AxesSubplot' object has no attribute 'sns'

Is there any way around this or would I just have to do a seaborn subplot ? I find matplotlib a lot easier.

Ruli
  • 2,592
  • 12
  • 30
  • 40
  • 1
    [Create the matplotlib figure, pass the axis to seaborn.](https://stackoverflow.com/a/33091668/8881141) – Mr. T Nov 08 '20 at 12:48
  • 2
    You need `sns.kdeplot(..., ax=data[2])`. It would be less confusing if you renamed the variable `data` to `axes`. Or you could assign the axes directly as `fig,(ax1,ax2,ax3)=plt.subplots(1,3)`. Also note that `plt.subplots()` creates just one single "figure" and 3 "axes". – JohanC Nov 08 '20 at 13:19

0 Answers0