ggplot_visualization.R 734 Bytes
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22

library(ggplot2)
library(data.table)
library(ggpubr)
data(iris)
iris <- data.table(iris)
iris <- iris[c(1:103)]

g1 <- ggplot(iris, aes(x = Species, y = Sepal.Length))+
  geom_bar(aes(fill = Species),stat="summary", fun.y="mean" ) +guides(fill = F)+
  ylim(c(0,8)) + ylab("Mean Sepal Lenght ")

g2 <- ggplot(iris, aes(x = Species, y = Sepal.Length))+
  geom_boxplot(aes(fill = Species))+
  ylim(c(0,8))+guides(fill = F)+ylab("Sepal Length")

g3 <- ggplot(iris, aes(x = Species, y = Sepal.Length))+
  geom_boxplot(aes(fill = Species))+
  ylim(c(0,8))+ geom_point( position="jitter")+
  guides(fill = F)+ylab("Sepal Length")

ggarrange(g1, g2, g3, nrow = 1)+ggsave(filename = "../plot-data.png", device = "png", width =12, height = 6)