Skip to content

Instantly share code, notes, and snippets.

@darioappsilon
darioappsilon / scatterplots.R
Created December 17, 2020 10:38
001_scatter_plots
library(ggplot2)
head(mtcars)
@darioappsilon
darioappsilon / scatterplots.R
Created December 17, 2020 10:38
002_scatter_plots
ggplot(mtcars, aes(x = mpg, y = hp)) +
geom_point()
@darioappsilon
darioappsilon / scatterplots.R
Created December 17, 2020 10:39
003_scatter_plots
ggplot(mtcars, aes(x = mpg, y = hp)) +
geom_point(size = 5, color = "#0099f9")
@darioappsilon
darioappsilon / scatterplots.R
Created December 17, 2020 10:39
004_scatter_plots
ggplot(mtcars, aes(x = mpg, y = hp)) +
geom_point(aes(size = qsec, color = cyl))
@darioappsilon
darioappsilon / scatterplots.R
Created December 17, 2020 10:40
005_scatter_plots
ggplot(mtcars, aes(x = mpg, y = hp)) +
geom_point(size = 5, color = "#0099f9", shape = 17)
@darioappsilon
darioappsilon / scatterplots.R
Created December 17, 2020 10:40
006_scatter_plots
library(ggrepel)
ggplot(mtcars, aes(x = mpg, y = hp)) +
geom_point(size = 5, color = "#0099f9") +
geom_text_repel(label = rownames(mtcars), size=3.5)
@darioappsilon
darioappsilon / scatterplots.R
Created December 17, 2020 10:41
007_scatter_plots
ggplot(mtcars, aes(x = mpg, y = hp)) +
geom_point(size = 5, color = "#0099f9") +
geom_label_repel(label = rownames(mtcars), size=3.5)
@darioappsilon
darioappsilon / scatterplots.R
Created December 17, 2020 10:42
008_scatter_plots
ggplot(mtcars, aes(x = mpg, y = hp)) +
geom_point(size = 5, color = "#0099f9") +
theme_classic()
@darioappsilon
darioappsilon / scatterplots.R
Created December 17, 2020 10:42
009_scatter_plots
ggplot(mtcars, aes(x = mpg, y = hp)) +
geom_point(color = "#0099f9", size = 5) +
geom_point(aes(size = qsec, color = cyl)) +
labs(
title = "Miles per Gallon vs. Horse Power",
subtitle = "Color - Number of cylinders; Size - 1/4 mile time",
caption = "Source: MTCars dataset"
)
@darioappsilon
darioappsilon / scatterplots.R
Created December 17, 2020 10:43
010_scatter_plots
ggplot(mtcars, aes(x = mpg, y = hp)) +
geom_point(color = "#0099f9", size = 5) +
geom_point(aes(size = qsec, color = cyl)) +
labs(
title = "Miles per Gallon vs. Horse Power",
subtitle = "Color - Number of cylinders; Size - 1/4 mile time",
caption = "Source: MTCars dataset"
) +
theme(
plot.title = element_text(color = "#0099f9", size = 20, face = "bold", hjust = 0.5),