How to decrease the alpha of points in an xy-plot using Base R and the ggplot2 package in the R programming language. More details: https://statisticsglobe.com/transpare...
R code of this video:
data <- data.frame(x = c(1, 1.1, 2, 2.1, 3, 3.1, 4, 4.1, 5, 5.1), # Example data
y = c(1, 1.1, 2, 2.1, 3, 3.1, 4, 4.1, 5, 5.1),
group = as.factor(1:2))
plot(data$x, # Draw non-transparent plot
data$y,
pch = 16,
cex = 5,
col = data$group)
install.packages("scales") # Install scales package
library("scales") # Load scales
plot(data$x, # Draw transparent plot
data$y,
pch = 16,
cex = 5,
col = alpha(data$group, 0.5))
install.packages("ggplot2") # Install ggplot2 package
library("ggplot2") # Load ggplot2
ggplot(data, aes(x, y, col = group)) + # Draw non-transparent plot
geom_point(size = 10)
ggplot(data, aes(x, y, col = group)) + # Draw transparent plot
geom_point(size = 10, alpha = 0.5)
Follow me on Social Media:
Facebook: / statisticsglobecom
LinkedIn: / statisticsglobe
Patreon: / statisticsglobe
Pinterest: https://www.pinterest.de/JoachimSchork
Reddit: / joachimschork
Twitter: / joachimschork
На этой странице сайта вы можете посмотреть видео онлайн Transparent Scatterplot Points in R (2 Examples) | scales & ggplot2 | Decrease Plot Opacity / Alpha длительностью часов минут секунд в хорошем качестве, которое загрузил пользователь Statistics Globe 31 Май 2021, поделитесь ссылкой с друзьями и знакомыми, на youtube это видео уже посмотрели 906 раз и оно понравилось 19 зрителям. Приятного просмотра!