Draw_bar_plot Test FAilure

Tell us what’s happening:
I was able to recreate the plot as shown in the example. I also got all the tags and labels to appear in the plot. For some reason, my barplot tests keep failing. The 3 errors always start with “‘numpy.ndarray’ object has no attribute …”. Any pointers are greatly appreciated. Thanks

Your code so far
# Copy and modify data for monthly bar plot
df_bar = df

df_bar["month"] = df.index.month_name()
df_bar["year"] = df.index.year

# Draw bar plot

fig = sns.catplot(x='year', y='value', hue='month', data=df_bar, kind='bar', 
            legend_out=False, palette="bright", 
            hue_order=['January', 'February', 'March', 'April', 'May', 
                       'June', 'July', 'August', 'September', 'October', 
                       'November', 'December'],
fig.set(ylabel = "Average Page View")
fig.add_legend(title="Months", label_order=['January', 'February', 'March', 
                                            'April', 'May', 'June', 'July', 
                                            'August', 'September', 'October',
                                            'November', 'December'])

# Save image and return fig (don't change this part)
return fig

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.121 Safari/537.36.

Challenge: Page View Time Series Visualizer

Link to the challenge:

sns.catplot() returns a FacetGrid object. You need a matplotlib Figure object for the tests to work correctly and to activate the Axes object. I accomplished this by using

graph = sns.catplot(...)

# Define fig for testing.
fig = graph.fig
# Call legend to make the legend active for testing.
ax = fig.axes[0].legend()

I mucked around reading the testing module to figure this out.

Posting a link to your repl.it project may also be helpful.


@jeremy.a.gray thanks for the pointer. That really helped.

Thats great! It worked! Thank You!