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
In questa pagina del sito puoi guardare il video online Transparent Scatterplot Points in R (2 Examples) | scales & ggplot2 | Decrease Plot Opacity / Alpha della durata di ore minuti seconda in buona qualità , che l'utente ha caricato Statistics Globe 31 maggio 2021, condividi il link con amici e conoscenti, su youtube questo video è già stato visto 906 volte e gli è piaciuto 19 spettatori. Buona visione!