R Data Visualization Recipes
上QQ阅读APP看书,第一时间看更新

There's more...

Did you note that the ggplot2 plot title is left aligned while plotly's is centered? Those are set by default and can be changed. For instance, one can centrally align the ggplot's title by summing the following code line:

> theme(plot.title = element_text( hjust = .5))

Also, note that the ggvis plot was the only one without a title. That happened because package version 0.4.3 did not had an easy way to add titles, although it's possible to sort of hack (in a good sense) the add_axis() function coerce a title. Next recipe teaches how to do it.