I think you are doing your code in the wrong place. Where is the “### START CODE HERE ###”? I never see an assignment where we have to code to plot a figure.
Moreover, instead of sharing your code, share only your full error. Sharing your code is against the community code of conduct.
Maybe you need to get a clean copy and do your code again, only where it is mentioned “### START CODE HERE ###” and “### END CODE HERE ###”. Check this guide for getting a fresh copy.
Best,
Saif.