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: http://docs.ggplot2.org/current/geom_tile.html However, they are not in relation to geom_bar()
A) First graph: (which works well)
ggplot(diamonds, aes(color, fill = cut)) +
geom_bar()
This plots frequency (y-axis) wrt color and fills based on "cut". I am good with this.
B) Now, in the second graph, I'm unsure what is happening:
ggplot(diamonds, aes(color, fill = cut)) +
geom_bar(position = "identity", alpha = 1 / 2, colour = "red")
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.
In drawing this, I am using publicly available ggplot2
library and diamond
dataset package that comes with it.
I am a beginner, so I am sorry if my question sounds too basic.