A basic text annotation
On the current scatter plot, you can see a particularly prominent point that contains the largest SO2 value observed for August. This point is Cincinnati on August 11th, 2013; however, you would not be able to learn this information from the plot in its current form. Basic text annotations are great for pointing out interesting outliers and giving a bit more information. Draw the readers attention to this Cincinnati value by adding a basic text annotation that gives a bit of the background about this outlier.
This exercise is part of the course
Improving Your Data Visualizations in Python
Exercise instructions
- Filter the data plotted in scatter plot to just August.
- Draw text annotation at
x = 0.57
andy = 41
to call out the highestSO2
value. - Label annotation with
'Cincinnati had highest observed\nSO2 value on Aug 11, 2013'
(note the line break). - Change the font-size to
'large'
for the annotation.
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# Draw basic scatter plot of pollution data for August
sns.scatterplot(x = 'CO', y = 'SO2', data = pollution[pollution.month == ____])
# Label highest SO2 value with text annotation
plt.text(____, ____,
'____',
# Set the font to large
fontdict = {'ha': 'left', '____': '____'})
plt.show()