r - Trouble coloring histogram -
i'm trying color range of values on histogram using 'ggplot2'. example i’ll use ‘diamonds’ dataset.
when execute follow comand:
qplot(carat, data=diamonds,geom="histogram", binwidth=0.01, fill=..count..) + scale_fill_continuous(low="#f79420", high="#f79420", limits=c(1000,3000))
i thw following , correct plot:
but when use syntax equivalent code, cannot same result. code:
ggplot(diamonds, aes(x = carat)) + geom_histogram( binwidth = 0.01, fill=aes(y = ..count..) ) + scale_fill_continuous(low="#f79420", high="#f79420", limits=c(1000,3000))
result:
can please tell me i’m doing wrong?
thanks.
try this:
ggplot(diamonds, aes(x = carat)) + geom_histogram( binwidth = 0.01, aes(fill = ..count..) ) + scale_fill_continuous(low="#f79420", high="#f79420", limits=c(1000,3000))
this give same picture first 1 above.
Comments
Post a Comment