How to in the R programming language. More details: [ Ссылка ]
R code of this video:
data <- data.frame(x1 = 1:4, # Create example data
x2 = 4:1,
group = LETTERS[1:4])
install.packages("ggplot2") # Install ggplot2 package
library("ggplot2") # Load ggplot2 package
ggp <- ggplot(data, aes(x1, x2)) + # Facet plot with default order
geom_point() +
facet_grid(.~group)
ggp # Draw facet plot
data_new <- data # Replicate data
data_new$group <- factor(data_new$group, # Reordering group factor levels
levels = c("B", "A", "C", "D"))
ggp_new <- ggplot(data_new, aes(x1, x2)) + # Create facet plot again
geom_point() +
facet_grid(.~group)
ggp_new # Print new facet plot
Follow me on Social Media:
Twitter: [ Ссылка ]
Facebook: [ Ссылка ]
Reddit: [ Ссылка ]
Pinterest: [ Ссылка ]
![](https://s2.save4k.ru/pic/4moGS1FGaR0/maxresdefault.jpg)