probability = True
to the arguments. Now the R code looks like this:
> hist(Cars93$Price, xlab="Price (x $1,000)", xlim = c(0,70),
main = "Prices of 93 Models of 1993 Cars",probability = TRUE)
The result appears here. The y-axis measures Density — a concept related to probability. The graph is called a density plot.
The point of all this is what you do next. After you create the graph, you can use an additional function called lines()
to add a line to the density plot:
> lines(density(Cars93$Price))
The graph now looks like the following image.
So in base R graphics, you can create a graph and then start adding to it after you see what the initial graph looks like. It’s something like painting a picture of a lake and then adding mountains and trees as you see fit.