Question: title: Viz II output: github_document --- ```{r setup, include=FALSE} library(tidyverse) library(patchwork) library(p8105.datasets) ``` Import the weather data ```{r} data(weather_df) ``` Let's make our basic scatterplot
title: "Viz II" output: github_document --- ```{r setup, include=FALSE} library(tidyverse) library(patchwork) library(p8105.datasets) ``` Import the weather data ```{r} data("weather_df") ``` Let's make our basic scatterplot ```{r} weather_df |> ggplot(aes(x = tmin, y = tmax)) + geom_point(aes(color = name), alpha = 0.5) + labs( x = "Minimum daily temp", y = "Maximum daily temp", title = "Temperature scatterplot", caption = "Data from NOAA", color = "Location" ) ``` ## Scales ```{r} weather_df |> ggplot(aes(x = tmin, y = tmax)) + geom_point(aes(color = name), alpha = 0.5) + labs( x = "Minimum daily temp", y = "Maximum daily temp", title = "Temperature scatterplot", caption = "Data from NOAA", color = "Location" ) + scale_x_continuous( breaks = c(-20, 0, 25), labels = c("-20C", "0", "25") ) + viridis::scale_color_viridis( discrete = TRUE ) ```
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
