课程: Data Visualization in R with ggplot2

免费学习该课程!

今天就开通帐号,24,700 门业界名师课程任您挑!

Adding titles

Adding titles

- [Instructor] Titles are an important part of any visualization. They may be used to explain a visualization or provide analysis and interpretation of the results. The ggtitle function allows us to add both titles and subtitles to a plot. The ggtitle function is pretty simple, so let's just give it a try. Here's the bar chart we've been working on and I'd like to give it a title. So I'm going to just, at the end of my plot here, add another function, ggtitle, and then I'm just going to simply provide it with a title I'd like to use. "More colleges are in the southern US than any other region," and when I run that, that title now appears at the top of my visualization. Now I can also add a subtitle. Let's say I'd like to add the source to this. I'm just going to add an argument. Subtitle equals, and then that text. "Source US Department of Education." And that's all there really is to titles. It's a good habit to add titles to visualizations that help the reader understand what…

内容