Sunday, 15 April 2012

r - Trouble coloring histogram -


I am currently trying to colorize several values ​​on the histogram using 'ggplot2'. For this example, I will use the 'diamond' dataset.

When I execute the following comand:

  qplot (carat, data = diamonds, geom = "histogram", binwidth = 0.01, fill = .. count .. I get a plot to get and correct the plot: + scale_fill_continuous (low = "# F79420", high = "# F79420", limit = C (1000,3000))  

Enter image details here

But when I get the equivalent code I use another syntax, so I can not get the same result. Code:

  ggplot (diamonds, AES (x = carat)) + geom_histogram (binwidth = 0.01, fill = aes (y = ..count ..)) + scale_fill_continuous (lower = "#  

This will give you the same picture as the first image above. < / P>


No comments:

Post a Comment