Data Analysis with Python Projects - Page View Time Series Visualizer

Tell us what’s happening:
Describe your issue in detail here.
There is one test failing on the legend of the bar plot

ERROR: test_bar_plot_legend_labels (test_module.BarPlotTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/runner/AnotherFineBetaversion/test_module.py", line 42, in test_bar_plot_legend_labels
    for label in self.ax.get_legend().get_texts():
AttributeError: 'NoneType' object has no attribute 'get_texts'

I don’t understand what is it trying to access, the bar plot has a legend by default

Your code so far

Your browser information:

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

Challenge: Data Analysis with Python Projects - Page View Time Series Visualizer

Link to the challenge:

sns.catplot does by default something weird with the legend, making it drawn outside of the plot (I guess that means outside of the fig object). Passing the legend_out=False argument to sns.catplot changes that behavior, and legend is recognized by test correctly. seaborn.catplot — seaborn 0.11.2 documentation

thank you very much!

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.