July 2019
Beginner to intermediate
740 pages
16h 52m
English
Some of the visualizations we have created thus far didn't have titles or axis labels. We know what is going on in the figure, but if we were to present them to others, there could be some confusion. It's good practice to be explicit with our labels and titles.
We saw that, when plotting with pandas, we could add a title by passing the title argument to the plot() method, but we can also do this with matplotlib using plt.suptitle(). Labeling our axes is just as easy; we can use plt.xlabel() and plt.ylabel(). Let's plot the Facebook closing price and label everything using matplotlib:
>>> fb.close.plot()>>> plt.suptitle('FB Closing Price')>>> plt.xlabel('date')>>> plt.ylabel('price ($)')
This results in the following plot: ...
Read now
Unlock full access