Anyone know a quick way to color one bar of a histogram?
I want to mark the bar in which the most recent observation falls.
So, for instance:
x - rnorm(100)
latest.ob - x[100]
hist(x)
## how do I mark the bucket that latest.ob falls into?
Thanks,
Whit
Whit Armstrong wrote:
Anyone know a quick way to color one bar of a histogram?
I want to mark the bar in which the most recent observation falls.
So, for instance:
x - rnorm(100)
latest.ob - x[100]
hist(x)
## how do I mark the bucket that latest.ob falls into?
Something like this:
That's great, Peter.
Thanks very much.
-Whit
On Tue, Oct 28, 2008 at 3:13 PM, Peter Dalgaard
[EMAIL PROTECTED] wrote:
Whit Armstrong wrote:
Anyone know a quick way to color one bar of a histogram?
I want to mark the bar in which the most recent observation falls.
So, for instance:
x -
Other option without rect is:
h - hist(x, plot = FALSE)
bin - as.numeric(cut(latest.ob, h$breaks))
plot(h, col = replace(rep(white, length(h$breaks) - 1), bin, red))
On Tue, Oct 28, 2008 at 4:48 PM, Whit Armstrong [EMAIL PROTECTED]wrote:
Anyone know a quick way to color one bar of a histogram?
Henrique Dallazuanna wrote:
Other option without rect is:
h - hist(x, plot = FALSE)
bin - as.numeric(cut(latest.ob, h$breaks))
plot(h, col = replace(rep(white, length(h$breaks) - 1), bin, red))
Nice. Some small improvements seem possible:
h - hist(x, plot = FALSE)
bin - cut(latest.ob,
5 matches
Mail list logo