ggplot2 | geom_bar and position = "identity"
<p>I am an absolute beginner, and I have recently started using excellent package ggplot. I have a question about using position = "identity" with bar chart. I searched through the internet and found this: <a href="http://docs.ggplot2.org/current/geom_tile.html" rel="nofollow">http://docs.ggplot2.org/current/geom_tile.html</a> However, they are not in relation to geom_bar()</p>

<p>A) First graph: (which works well)</p>

<pre><code>ggplot(diamonds, aes(color, fill = cut)) +
geom_bar()
</code></pre>

<p>This plots frequency (y-axis) wrt color and fills based on "cut". I am good with this.</p>

<p>B) Now, in the second graph, I'm unsure what is happening:</p>

<pre><code>ggplot(diamonds, aes(color, fill = cut)) +
geom_bar(position = "identity", alpha = 1 / 2, colour = "red")
</code></pre>

<p>Can someone please explain why the second graph is a little different (i.e. the height of bar graph is different in the two graphs; color scheme has also changed--I would have expected the bars to be red because I am explicitly setting colour = "red" but the bars have gradient color scheme, and they have a "red" border.</p>

<p>In drawing this, I am using publicly available <code>ggplot2</code> library and <code>diamond</code> dataset package that comes with it.</p>

<p>I am a beginner, so I am sorry if my question sounds too basic. </p>