library(ggplot2)
library(gridExtra)
p1 <- ggplot(data = mtcars, aes(x = carb)) +geom_density(aes(fill = factor(carb), alpha = 0.7)) +labs(fill = "#carb", x="Carb", y="density", title="CrabDensity - 21MIC0065") +scale_fill_brewer(palette = "Dark2")
p2 <- ggplot(data = mtcars, aes(x = factor(carb))) + geom_bar(aes(fill = factor(carb)), alpha = 0.7) + labs(fill = "#carb", x="Carb", y="frequency", title="CrabFrequency - 21MIC0065") +scale_fill_brewer(palette = "Accent")
p3 <- ggplot(data = mtcars, aes(x = cyl)) + geom_histogram(aes(fill= factor(cyl)), alpha=0.7) + labs(x = "Miles Per Gallon (mpg)", y = "Frequency", title = "Histogram of MPG - 21MIC0065") +scale_fill_brewer(palette = "Set1")
p4 <- ggplot(data = mtcars, aes(x = carb, y = drat, color = factor(carb))) + geom_point() +labs(color = "#carb", x="Dart", y="Carb", title="Drat_vs_carb - 21MIC0065") +scale_color_brewer(palette = "Accent")
p5 <- ggplot(data = mtcars, aes(x = carb, y = mpg)) +geom_boxplot(aes(fill= factor(carb), alpha=0.7)) +labs(x = "Carb", y = "Miles Per Gallon (mpg)", title = "Boxplot of MPG VS CYL - 21MIC0065")+ scale_color_brewer(palette = "Set3")
p6 <- ggplot(data = mtcars, aes(x = mpg, y = carb, color = factor(carb))) + geom_line(linetype = "dashed") +labs(color = "#carb", x="MPG", y="Crab", title="MPG vs Carb line plot - 21MIC0065") +scale_color_brewer(palette = "Set2")
grid.arrange(p1, p2, p3, p4, p5, p6, nrow=2)
## Warning: Groups with fewer than two data points have been dropped.
## Groups with fewer than two data points have been dropped.
## Warning in max(ids, na.rm = TRUE): no non-missing arguments to max; returning
## -Inf
## Warning in max(ids, na.rm = TRUE): no non-missing arguments to max; returning
## -Inf
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
