Skip to content
Prev 260706 / 398503 Next

histogram with density

Hi,
On Mon, May 23, 2011 at 11:41 PM, Rekha <chithralekha86 at gmail.com> wrote:
You should use the code above.

I don't get it though -- this is working fine for me. Are you getting
the "plot.new" error for both versions of your code?

Although I feel like in 99% of the time this won't be necessary, but
what happens if you call `plot.new()` before your call to hist?

eg:

R> x <- rnorm(200)
R> plot.new()
R> hist(x, col = "blue", freq = FALSE)
R> lines(density(x), col = "red", lwd = 2)

Does that work? If not -- what if you use `dev.new()` in place of `plot.new()`?

-steve