title: Different category histograms with ggplot2 in R
body: <p>Here is my code:</p>
  <pre><code>set.seed(0)
  practice&lt;-matrix(c(c(&quot;class1&quot;,&quot;class2&quot;,&quot;class3&quot;,&quot;class4&quot;,&quot;class5&quot;,&quot;class6&quot;),sample(1:100,30)),ncol=6)
  colnames(practice)&lt;-c(&quot;classes&quot;,&quot;Strongly_Agree&quot;,&quot;Somewhat_Agree&quot;,&quot;Somewhat_Disagree&quot;,
          &quot;Strongly_Disagree&quot;,&quot;No_Idea&quot;)
  data&lt;-as.data.frame(practice)
  require(ggplot2)
  require(reshape2)
  new_data&lt;-melt(data,id.vars=c(&quot;classes&quot;))
  graph&lt;-ggplot(new_data,aes(x = variable, y=..density..,fill=variable)) 
  graph&lt;-graph+facet_wrap(~classes,scales = &quot;free_y&quot;)
  graph+geom_histogram()
  </code></pre>
  <p><img src="https://i.stack.imgur.com/ybokk.png" alt="Graph I got" /></p>
  <p>Everything looks right except that I wonder why the histograms have the same length. What I want is to show the percentage of students with different opinions in the six classes (x-axis:strongly agree, somewhat agree....,y-axis:the percentage of different groups of people). What else I need to add for the code? scale?</p>
  <p>Thank you so much!</p>