How to make R side by side two column histogram (above) which I am able to do in python (
CodePudding user response:
Here is an example using the iris
data set.
First you have to bring the data in long format with pivot_longer
and then apply geom_histogram()
with position= 'dodge'
library(tidyverse)
iris %>%
pivot_longer(
c(Sepal.Length, Sepal.Width, Petal.Length)
) %>%
ggplot(aes(value, fill=name))
geom_histogram(position = "dodge")