Exercises
- What geoms would you use to draw each of the following plots?
- Scatterplot:
geom_point()
- Line Chart:
geom_line()
- Histogram:
geom_histogram()
- Bar Chart:
geom_bar(stat = "identity")
- Pie Chart:
geom_bar(width = 1, stat = "identity") + coord_polar(theta = "y")
- Differences between
geom_path() and geom_polygon()
geom_path() connects points in the order they appear.
geom_polygon() connects points and closes the shape by linking the last point back to the first.
- Differences between
geom_path() and geom_line()
geom_line() connects points in order of x values.
geom_path() follows the exact order of points in the dataset.
- Low-level geoms used in composite geoms
geom_smooth(): Uses geom_line() and geom_ribbon().
geom_boxplot(): Uses geom_segment() and geom_rect().
geom_violin(): Uses geom_density_ridges().