How do I highlight an observation's bin in a histogram in R -
I want to create a histogram with many observations (i.e. d & lt; -c (1,2.1,3,4, 4,5)) and then highlight the bin made in a special overview, like I have output which looks like this:
How do I do this in R?
Extending the answer to KhaustStat, here is a small task that automatically finds which bin Contains the value you want to highlight:
Highlight and Lieutenant; - Function (x, value, col.value, col = NA, ...) {hst & lt; - Hist (X, ...) idx & lt; - findInterval (value breaks, hst $)) Cols & lt; - Representative (Colonel, Length (calculation of hst $)) cols [idx] & lt; - col.value hist (x, col = cols, ...)}
now
x < - The rnorm (100) Highlight (X, 1.2, "red")
will highlight the bin in 1.2 in red.
Comments
Post a Comment