In this demo I will be making some plots using the Iris data set – a boxplot and a scatter plot
This report will be a demo for the website that I am working on. This will just demonstrate my basic capabilities with the ggplot2 library by constructing a boxplot and a scatterplot with multiple linear models.
data %>%
ggplot(aes(x = Species, y = Sepal.Length, fill = Species)) +
geom_boxplot(aes(group = Species)) +
labs(x = "Species",
y = "Sepal Length",
title = "Sepal Length Box Plot by Species") +
theme(plot.title = element_text(hjust = 0.5),
legend.position = "none") +
scale_fill_d3()
data %>%
ggplot(aes(x = Sepal.Length, y = Sepal.Width, color = Species)) +
geom_point(aes(group = Species)) + geom_smooth(method = "lm", se = FALSE) +
labs(x = "Sepal Length",
y = "Sepal Width",
title = "Sepal Width Function of Sepal Length") +
scale_color_d3() +
theme(plot.title = element_text(hjust = 0.5),
legend.position = "top")
Dependent variable: | |
Sepal Length | |
Versicolor | 1.459*** |
(0.112) | |
Virginica | 1.947*** |
(0.100) | |
Sepal Width | 0.804*** |
(0.106) | |
Constant | 2.251*** |
(0.370) | |
Observations | 150 |
R2 | 0.726 |
Adjusted R2 | 0.720 |
Residual Std. Error | 0.438 (df = 146) |
F Statistic | 128.888*** (df = 3; 146) |
Note: | p<0.1; p<0.05; p<0.01 |