Hi, I am trying to put the info of two different database in one ggplot. In this case a violin_plot(). I would like to see something like this graph but with two graphics. One with the data of 2018 in the left and the other two violins from 2019 in the right. Do you think is possible if the data have different length?
My data:
library(tidyverse)
my_data_2018 <- tibble(Var_1 = c(900, 1500, 350, 1200, 750, 100,125,250,300),
Gender = c("W", "W", "W", "M", "M", "W", "W", "M", "W"),
my_weights = c(2.2, 3.1, 8.2, 4.2, 5.3, 6.8, 12, 25, 1))
my_data_2019 <- tibble(Var_2 = c(32, 21, 21, 900, 1500, 350, 1200, 750, 100,125,250,300),
Gender_2 = c("W", "W", "W","W", "W", "W", "M", "M", "W", "W", "M", "W"),
my_weights_2 = c(2.2, 3.1, 8.2, 2.2, 3.1, 8.2, 4.2, 5.3, 6.8, 12, 25, 1))
The output with one graph:
my_data_2018 %>%
ggplot(aes(x = 0 , y = Var_1, weight = my_weights, fill = Gender))+
geom_violin(color = "black", scale = "count")
I just stuck trying to introduce the data of 2019 in the same plot