Using the mpg dataset in the ggplot2 package, replicate the plot below using the following settings:
alpha = 0.5 for the width of barstheme_minimal()# you need `ggplot2` package to use `mpg` dataset
library(ggplot2)
Using the mpg dataset in the ggplot2 package, replicate the plot below using the following settings:
alpha = 0.5 for the width of barsfacet_grid()theme_minimal()# you need `ggplot2` package to use `mpg` dataset
library(ggplot2)
Using the midwest dataset in the ggplot2 package, replicate the plot below using the following settings:
x=area and y=poptotalalpha = 0.4c(0, 0.1)c(0, 500000)se=FALSE option within geom_smooth() to remove confidence bandslibrary(ggplot2) # you need `ggplot2` to use `midwest` data
options(scipen=999) # turn-off scientific notation like 1e+48
ggplot(data = mpg, mapping = aes(x = displ, y = hwy)) +
geom_point(aes(color=drv)) + geom_smooth(method="lm") +
labs(title ="MPG vs Engine size", x = "Engine size", y = "MPG")
## `geom_smooth()` using formula 'y ~ x'
Using the iris dataset in the datasets package (dataset package belongs to Base R and so you don’t need to download the package), replicate the plot below using the following settings:
size = 6 for the size of pointsalpha = 0.5theme_minimal()(iris is another famous dataset in R. You may google or check the this link to learn more about the dataset)
Using the heightweight dataset in the gcookbook package, replicate the plot below using the following settings:
size = 3 of pointsalpha = 0.5theme_classic()library(gcookbook)
Using the mpg dataset in the ggplot2 package, replicate the plot below using the following settings:
width = 0.5 for the width of barspalette = "Spectral" for colorlibrary(ggplot2)