plot density line using lines in r


Hi, I am trying to plot a density curve on top of the density histogram. My code works fine in the first graph, which shows by a red line almost identical with the histogram; however, I cannot see the red line in the second graph by using identical code but different data set.
It seems line lines() does not work

use:

curve( rchisq(100000, df = 1), add = TRUE, 
       col = rgb(1,0,0,.4), lwd = 3)

lines doesn't work :relaxed: @Kevinn

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.