I'm looking to plot the distribution of age across the different trees in the locality data.
I did the following but the graph isn't representative :
ggplot(tree_data, aes(x = Age.Life, fill = Tree)) +
geom_density(alpha=.5) +
scale_fill_brewer(palette="Set1")
Try the geom_boxplot()
distribution:
ggplot(iris, aes(x = Petal.Length, fill=Species)) +
geom_boxplot() +
scale_fill_brewer(palette="Set1")
Or geom_histogram()
As @akrun suggests. I've added combined with facet_grid()
.
ggplot(iris, aes(x = Petal.Length, y=Species, fill=Species)) +
geom_histogram() +
scale_fill_brewer(palette="Set1")+
facet_grid("Species")
And the popular geom_violin()
plot
ggplot(iris, aes(x = Petal.Length, y=Species, fill=Species)) +
geom_violin() +
scale_fill_brewer(palette="Set1")