From the course: Data Visualization with Matplotlib and Seaborn
Unlock this course with a free trial
Join today to access over 24,900 courses taught by industry experts.
Pro tip: Text annotations - Python Tutorial
From the course: Data Visualization with Matplotlib and Seaborn
Pro tip: Text annotations
- [Instructor] Okay, so in the last version of our chart, we put text into our chart to point out when the start of Covid was. Another way to do this that will give you a little bit prettier arrow is using annotations. These can seem very complex at first, but a lot of the times we're just going to develop a very simple template and use that style every time we use annotations. There are a ton of options for these, but let's take a look at what an annotation is. These are a great way to call-out and label important data points. So in order to annotate a specific point, we want to provide a string. This is going to be the text that we're calling out. We then need to specify the data point coordinate that we want to point to, followed by the text coordinate, and then the style of arrow we want to provide. We can also format our text just like we saw in the last demo. So here's an example of annotating a chart. So we're just going to include the last piece of our code here. But let's…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
(Locked)
Intro to Matplotlib6m 39s
-
(Locked)
Plotting methods6m 56s
-
(Locked)
Plotting DataFrames5m 35s
-
(Locked)
Challenge: Plotting DataFrames3m 14s
-
(Locked)
Solution: Plotting DataFrames2m 26s
-
(Locked)
Anatomy of a Matplotlib figure4m 9s
-
(Locked)
Chart titles and font sizes9m 46s
-
(Locked)
Chart legends10m 21s
-
(Locked)
Line styles2m 54s
-
(Locked)
Axis limits5m 30s
-
(Locked)
Figure sizes5m 13s
-
(Locked)
Custom axis ticks4m 3s
-
(Locked)
Vertical lines6m 43s
-
(Locked)
Adding text4m 38s
-
(Locked)
Pro tip: Text annotations5m 18s
-
(Locked)
Removing borders5m 59s
-
(Locked)
Challenge: Formatting charts2m 7s
-
(Locked)
Solution: Formatting charts2m 55s
-
(Locked)
Line charts3m 30s
-
(Locked)
Stacked line charts6m 41s
-
(Locked)
Dual axis charts8m 51s
-
(Locked)
Challenge: Dual axis line charts1m 51s
-
(Locked)
Solution: Dual axis line charts2m 43s
-
(Locked)
Bar charts10m 19s
-
(Locked)
Challenge: Bar charts1m 23s
-
(Locked)
Solution: Bar charts2m 37s
-
(Locked)
Stacked bar charts5m 25s
-
(Locked)
Grouped bar charts7m 38s
-
(Locked)
Combo charts7m 56s
-
(Locked)
Challenge: Advanced bar charts1m 22s
-
(Locked)
Solution: Advanced bar charts2m 56s
-
(Locked)
Pie and donut charts10m 37s
-
(Locked)
Challenge: Pie and donut charts1m 15s
-
(Locked)
Solution: Pie and donut charts2m 2s
-
(Locked)
Scatterplots and bubble charts5m 13s
-
(Locked)
Histograms10m 10s
-
(Locked)
Challenge: Scatterplots and histograms1m 40s
-
(Locked)
Solution: Scatterplots and histograms2m 44s
-
(Locked)
Key takeaways2m 23s
-
(Locked)
-
-
-
-
-