What does 'fig not defined' mean?

Hi! So I did the the time visualizer project in jupyter, and it worked, but when I copy code over, I keep getting errors that make ZERO sense. Whether or not I include the ‘fig = ’ in the first line of the code below, I get the error ’ in draw_line_plo fig.savefig(‘line_plot.png’) NameError: name ‘fig’ is not defined’. What do I do to fix this error?

The error is raised in line 22, which is the line that defines the title of this graph. I’m VERY confused about why THAT line would raise an error around whether or not I defined ‘fig’.

fig = plt.figure(figsize= (20,5))

plt.plot(df_new, color='r')

plt.title('Daily freeCodeCamp Forum Page Views 5/2016-12/2019')
plt.ylabel('Page Views')


Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.114 Safari/537.36

Challenge: Page View Time Series Visualizer

Link to the challenge:

Would you be able to share more of your code snippet?


plt.plot(x ,np.cos(), color = ‘r’ ) Espero te ayude un espacio entre dato y función
espero no confundirte. es el orden para identificar una matriz

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