From the course: Data Visualization with Matplotlib and Seaborn

Unlock this course with a free trial

Join today to access over 25,200 courses taught by industry experts.

Adding text

Adding text

- [Instructor] Okay, so let's take a look at adding text to our charts. A lot of the times we might want to add additional text beyond our chart titles or access labels or legend to give our audience more context. So, the way that we add text to our charts is use the text method, not too surprisingly. We pass in an x-coordinate and a y-coordinate for where our text is going to start, and then we pass in the string of interest before any additional text formatting options we want to apply. For example, font size, font color, or the font itself. So, let's go ahead and take a look at adding some text here. So, we have our chart we built in the prior slide. Now, at the bottom line, I've called the text method on our chart, specified our text to start at 17,850. Note that our vertical line starts at 18,341, so the length of our text is going to run from 17,850, 'til wherever our text ends, so this requires a little bit of tuning if we want to point to a specific data point like this…

Contents