Under the Hood: Matplotlib
.plot() is a wrapper for
pyplot.plot(), and the result is a graph identical to the one you produced with Matplotlib directly. You can use
df.plot() to produce the same graph from columns of a
DataFrame object. However, if you already have a
DataFrame instance, then
DataFrame.plot() offers a cleaner syntax than
If you’re already familiar with Matplotlib, then you may be interested in the
kwargs parameter to
.plot(). You can pass it a dictionary containing keyword arguments that will then be passed on to Matplotlib’s plotting backend. For more information on Matplotlib, check out Real Python’s Python Plotting With Matplotlib course.
Become a Member to join the conversation.