- This graph demonstrtates the relationship between the weight of the baby chicks and the type of feed they were given.
library(ggplot2)
library(dplyr)
library(ggthemes)
chickwts.tbl <- tbl_df(chickwts)
ggplot(chickwts.tbl, aes(x=weight, y=feed))+
geom_point()+
labs(title="Weight of Chicks Compared with Their Feed",
x="Weight", y= "Type of Feed")+
theme(legend.position = "top")+
theme_classic()
*This plot is a different view of the relationship between chick weight and the type of feed they were fed.
chickwts.tbl <- tbl_df(chickwts)
ggplot(chickwts.tbl, aes(x=feed, y=weight))+
geom_point()+
labs(title="Weight of Chicks Compared with Their Feed",
x="Type of Feed", y= "Weight")+
theme(legend.position = "top")+
theme_classic()
*This plot is a bar chart showing how many chicks were assigned to each different type of feed group.
chickwts.tbl <- tbl_df(chickwts)
ggplot(chickwts.tbl, aes(x=feed))+
geom_bar()+
labs(title="Number of Chicks in Assigned to Each Feed Group",
x="Type of Feed", y= "Number of Chicks")+
theme(legend.position = "top")+
theme_classic()
*This is a chart demonstrating how many chicks weighed a certain amount and the color indicates which feed group they were in.
chickwts.tbl <- tbl_df(chickwts)
ggplot(chickwts.tbl, aes(x=weight, color= feed))+
geom_histogram()+
labs(title="Number of Chicks in Each Weight",
x="Weight", y= "Number of Chicks")+
theme(legend.position = "top")+
theme_few()
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
*This plot is another version demonstrating the relationship of the chick weight compared to the type of feed they are fed.
chickwts.tbl <- tbl_df(chickwts)
ggplot(chickwts.tbl, aes(x=weight, y= feed))+
geom_boxplot()+
labs(title="Chick Weight Compared to the Type of Feed They are Fed",
x="Weight", y= "Feed")+
theme(legend.position = "top")+
theme_few()
## Warning: position_dodge requires non-overlapping x intervals