Reputation: 3
Can anyone help me understand this error:
AttributeError: 'Figure' object has no attribute 'yaxis'
This is my code:
import matplotlib.pyplot as plt
import seaborn as sns
import warnings as wrn
from Data_Science.Category_Data_Types import movies
wrn.filterwarnings('ignore')
sns.set_style('whitegrid')
axes = plt.subplots(1, 2, figsize=(12, 6))
sns.kdeplot(movies.BudgetMillions, movies.AudienceRating, ax=axes[0])
sns.kdeplot(movies.BudgetMillions, movies.CriticRating, ax=axes[1])
plt.show()
Upvotes: 0
Views: 2600
Reputation: 2895
change the relevant line to -
_, axes = plt.subplots(1, 2, figsize=(12, 6))
The first output is the figure
object, so when you refer to axes[0]
you're actually inputting a figure
object, which justifiably has no yaxis
attribute.
Upvotes: 1