I have a movie data with respect to different genres. My ultimate objective is to create a box plot of age wise ratings of films for different genres ie if action is one of the genres, I want to create a box plot of age wise ratings with each box plot representing a certain age group. I tried using the code :
boxplot(cbind(Action_Subset$U_18_ratings,Action_Subset$Between_18_to_29_ratings,Action_Subset$Between_30_to_44_ratings,Action_Subset$Ratings_above_45))
I am able to create the box plots but unable to represent it according to different age groups.
How can I highlight which boxplot represents ratings for particular age group.
Expecting that each column has same number of rows!
data_boxplot <- cbind(Action_Subset$U_18_ratings,
Action_Subset$Between_18_to_29_ratings,
Action_Subset$Between_30_to_44_ratings,
Action_Subset$Ratings_above_45) %>%
mutate(ID = row_number()) %>%
pivot_longer(-ID)
p <- ggplot(dat_plot)+ geom_boxplot(aes(x = name, y = value, fill = name))
p
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.