Getting 2 errors: test_line_plot_labels

Hey everyone, I am getting these 2 errors. I am using Seaborn to plot my bar graph, and my labels for my x and y-axis are as follow:

g = sns.catplot(data=df_cat, kind=“count”, x=“variable”, hue=“value”, col=“cardio”)
g.set_axis_labels(“variable”, “total”)

However----- I am getting these 2 errors. Everything else seems fine. Can you help?

ERROR: test_bar_plot_number_of_bars (test_module.CatPlotTestCase)

Traceback (most recent call last):
File “/home/runner/boilerplate-medical-data-visualizer-8/test_module.py”, line 26, in test_bar_plot_number_of_bars
actual = len([rect for rect in self.ax.get_children() if isinstance(rect, mpl.patches.Rectangle)])
AttributeError: ‘numpy.ndarray’ object has no attribute ‘get_children’

======================================================================
ERROR: test_line_plot_labels (test_module.CatPlotTestCase)

Traceback (most recent call last):
File “/home/runner/boilerplate-medical-data-visualizer-8/test_module.py”, line 13, in test_line_plot_labels
actual = self.ax.get_xlabel()
AttributeError: ‘numpy.ndarray’ object has no attribute ‘get_xlabel’


Ran 4 tests in 17.636s

FAILED (errors=2)

Your code so far

Click here for my code!

Challenge: Medical Data Visualizer

Link to the challenge:

sns.catplot doesn’t return figure object, which is expected by the tests. It returns FacetGrid.

I am a bit confused then, as in the instructions, it says to to draw the catplot using SNS.

“# Draw the catplot with 'sns.catplot()”

Am I suppose to draw the bar plot with Matlibplot?

No, there’s just needed one more step - to take out figure object from the FacetGrid and return that.

Thank you Sanity! It seems I didn’t understand what some of the earlier posts were saying. For those lost---- : read this:

Courtesy of Sanity:
g = sns.catplot(…)
g.(…) # setting y label in here
fig = g.fig