Bar plot: show grouped bar instead of just one
<p>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. </p>

<p>There are only 3 categories.</p>

<p>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?</p>

<p>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.</p>

<pre><code> barplot(tapply(data$movieruntime, data$movierating, mean), ylim=c(0,1300))
</code></pre>

<p>Im trying like this now:</p>

<pre><code>barchart(data$movierating~ data$movieruntime, groups=data$moviecategory, data, auto.key = list(columns = 3))
</code></pre>

<p>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?</p>