Reputation: 5078
I am replicating simulation results from a published study. The authors present their output in a density plot (below) that is very rectangular. They appear to have created bins and then plotted the midpoint of the bins. Is it possible to easily build this type of plot using base R graphics or ggplot?
Upvotes: 0
Views: 563
Reputation: 2460
Very simple indeed:
data=rnorm(1000)
hist_info=hist(data, plot=F)
plot(hist_info$mids, hist_info$density, type="l", xlab="X", ylab="density")
Upvotes: 1