R Cookbook by JD Long

R Cookbook by JD Long

Author:JD Long
Language: eng
Format: epub
Publisher: O'Reilly Media
Published: 2019-07-15T16:00:00+00:00


data(Cars93, package = "MASS") ggplot(Cars93, aes(MPG.city, Horsepower)) + geom_point() + facet_wrap( ~ Origin)

Figure 10-26. Cars93 data with facet

The resulting plot reveals a few insights. If we really crave that 300-horsepower monster, then we’ll have to buy a car built in the USA; but if we want high MPG, we have more choices among non-USA models. These insights could be teased out of a statistical analysis, but the visual presentation reveals them much more quickly.

Note that using facet results in subplots with the same x- and y-axis ranges. This helps ensure that visual inspection of the data is not misleading because of differing axis ranges.



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.