mk_dotplot | R Documentation |
mk_dotplot
takes a data frame as input and returns a function for
making dotplots with any continuous variable from the data frame on the
x-axis. The dots are stacked along the y axis. The returned faction can also
optionally take a grouping variable so that the dots are filled with
different colors for different groups.
mk_dotplot(df)
df |
A data frame. |
function(xvar, fillby = "1",
legend_title = fillby, legend_pos = "right",
label_size = 3, font_size = 14)
xvar. String, name of a continuous variable for x-axis.
fillby. String, name of a categorical variable for grouping and coloring each dot. Default = "1", meaning no such variable is supplied.
legend_title. String, legend title. Default is the name of the fillby variable.
legend_pos. String, legend position. Default = "right".
label_size. Integer, size of bar label text. Default = 3.
font_size. Overall font size. Default = 14. The font size of the axes and legend text is a fraction of this value.
.... Other parameters that can be passed into 'ggplot2::geom_dotplot()'. For example, 'binwidth', which can be specified as a number or a function that calculates width from x. Default is 30 bins, which can be overridden by the supplied 'binwidth' value. Two other common parameters are 'dotsize' and 'stackratio', which controls the size of the dots and the spaces between the dots.
inst/examples/ex-mk_dotplot.R
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.