FAQ Database Discussion Community


Generating a histogram and density plot from binned data

r,ggplot2,histogram,density-plot
I've binned some data and currently have a dataframe that consists of two columns, one that specifies a bin range and another that specifies the frequency like this:- > head(data) binRange Frequency 1 (0,0.025] 88 2 (0.025,0.05] 72 3 (0.05,0.075] 92 4 (0.075,0.1] 38 5 (0.1,0.125] 20 6 (0.125,0.15] 16...

Stratifying a density plot by different groups using ggplot2 in R

r,ggplot2,histogram,category,density-plot
I have a data frame in R called x that has hundreds of rows. Each row is a person. I have two variables, Height, which is continuous, and Country, which is a factor. I want to plot a smoothed histogram of all of the heights of the individuals. I want...

Plot quantiles of distribution in ggplot2 with facets

r,ggplot2,quantile,density-plot
I'm currently plotting a number of different distributions of first differences from a number of regression models in ggplot. To facilitate interpretation of the differences, I want to mark the 2.5% and the 97.5% percentile of each distribution. Since I will be doing quite a few plots, and because the...

Get rid of gray line in R density plot density at y = 0

r,plot,postscript,eps,density-plot
I have a density plot that I want to save in an eps file. My density plot is something like setEPS() postscript("myfile.eps") plot(density(rnorm(1000))) dev.off() just with my data and a little bit more complex (changing labels and margins, more lines on top of it, etc). My problem is that I...

Plot density distribution

plot,distribution,density-plot
I have generated a bunch of data, and want to plot how they are distributed using matplotlib. How should I proceed? Thank you for answers ...

Smooth a density plot so that it doesn't appear saw toothed

r,smooth,smoothing,density-plot
I have made a density plot in R. I want to get rid of the saw tooth pattern and have it be entirely smooth. The reason that it appears saw tooth is because the values of x$PLCO2 are all whole numbers. But I want to smooth the plot for aesthetic...