11.47 Scatter Plot

20200822

set.seed(26439)
ds %>%
  sample_n(100) %>%
  ggplot(aes(x=min_temp, y=max_temp)) +
  geom_point() +
  labs(x = vnames["min_temp"], 
       y = vnames["max_temp"])

The simplest of plots is a scatter plot which displays a two dimensional plot of points. The dimensions are the and axes. The observations from the dataset, which are the rows in the dataset, are plotted, scattering the points over the plot.

Using the template variable ds the dataset is piped (%>%) into ggplot2::ggplot(). The aesthetics ggplot2::aes() are set up with min_temp as the axis and max_temp as the axis. To add the points (observations) to the plot we employ ggplot2::geom_point().



Your donation will support ongoing development and give you access to the PDF version of this book. Desktop Survival Guides include Data Science, GNU/Linux, and MLHub. Books available on Amazon include Data Mining with Rattle and Essentials of Data Science. Popular open source software includes rattle, wajig, and mlhub. Hosted by Togaware, a pioneer of free and open source software since 1984.
Copyright © 1995-2021 Graham.Williams@togaware.com Creative Commons Attribution-ShareAlike 4.0.