plt.plot(women_degrees['Year'], women_degrees['Biology'], color="blue", label="Women") plt.plot(women_degrees['Year'], 100-women_degrees['Biology'], color="green", label="Men") plt.tick_params(bottom="off", top="off", left="off", right="off") plt.title("Percentage of Biology Degrees Awarded By Gender") plt.legend(loc="upper right") plt.show()
What I expected to happen:
My code worked and I wasn’t expecting it to…I used plt.tick_params because I didn’t have an Axes object created and I was curious to see if it worked. What I am confused about is why my code worked. I don’t understand how Matplotlib was able to access the tick_params() method when there wasn’t an instance of the Axes Class initiated.
Also after comparing the answer to my code, I see I was able to further access other methods (‘legend’, ‘title’) that are also part of the Axes class. Just a little confused about how I should be writing my code–whether initiating objects or simply accesses the same methods/attributes from plt.
TL;DR:Looking for some help understanding the way Matplotlib works with the the underlying Figure and Axes Classes and why I was able to access this method with no object.
What actually happened:
Replace this line with the output/error