Now iam interested in creating a ggplot income distribution by retirement.
Add rug plot ggplot2.
Rug plots display individual cases so are best used with.
Description usage arguments details aesthetics examples.
Create elegant data visualisations using the grammar of graphics.
Geom rug mapping null data null.
Add add marginal rugs and use jittering to avoid overplotting ggplot iris aes x petal length y petal width geom point geom rug position jitter size 2.
All objects will be fortified to produce a data frame.
Note you can as well add marginal plots to show these distributions.
You can easily add rug on x and y axis thanks to the geom rug function to illustrate the distribution of dots.
By using geom rug you can add marginal rugs to your scatter plot.
I also need to create a rugs on the left side of the plot.
Rug plots display individual cases so are best used with smaller datasets.
A rug plot is a compact visualisation designed to supplement a 2d display with the two 1d marginal distributions.
If null the default the data is inherited from the plot data as specified in the call to ggplot.
Library library ggplot2 iris dataset head iris plot ggplot data iris aes x sepal length petal length geom point geom rug col steelblue alpha 0 1 size 1 5.
If you have too many points you can jitter the line positions and make them slightly thinner.
As pointed out by csgroen geom rug is the equivalent of rug function.