0

Im trying to do a barplot using three variables, movie runtime, moviecategory and movierating. I have movierating on the x axis and movieruntime on the y axis.

There are only 3 categories.

The bar plot is ok but instead of have just one bar for each relation between movieruntime and movie category I want to have three bars for each bar, each bar corresponding to each category. Do you know how to do that?

The code I have now is this, but just show one bar for each relation between movieruntime and movie rating. I want something like a grouped bar for each rating.

 barplot(tapply(data$movieruntime, data$movierating, mean), ylim=c(0,1300))

Im trying like this now:

barchart(data$movierating~ data$movieruntime, groups=data$moviecategory, data, auto.key = list(columns = 3))

But Im get the bars on the horizontal not vertical and the movieruntime is on the x axis but I want on the y axis. Do you know how to fix?

Azz
  • 49
  • 1
  • 2
  • 10
  • It's easier to help when you provide a [reproducible example](http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) with sample input data that we can copy/paste into R to see what you are seeing. – MrFlick Oct 10 '16 at 22:08
  • 1
    `beside = TRUE` ? – rawr Oct 10 '16 at 22:08

0 Answers0