View source: R/mk_percentileplot_convars.R
mk_percentileplot_convars | R Documentation |
mk_percentileplot_convars
takes a data frame as input and returns a
function for binning a continuous variable from the data frame, and plotting
the average values of the bins on the x-axis and the (25th, 50th and 75th)
percentiles of another continuous variable grouped by the bins on the y axis.
This is a good alternative to scatterplots when the data points overlap.
mk_percentileplot_convars(df)
df |
A data frame. |
function(xvar, yvar, pt_size = 1, linew = 0.7, xcuts = 15,
probs = c(0.75, 0.5, 0.25),
legend_title = c('75th', '50th', '25th'), legend_pos = "right",
font_size = 14)
xvar. String, name of a continuous variable for x-axis.
yvar. String, name of a continuous variable for y-axis.
pt_size. Number, size of the points. Default = 1.
linew. Number, width of the line. Default = 0.7.
xcuts. A numeric vector of two or more unique cut points or a single number (greater than or equal to 2) giving the number of intervals into which x is to be cut. Default = 15.
probs. Numeric vector. Probabilities for which the percentiles will be calculated and plotted. Default = c(0.75, 0.5, 0.25), and it'll plot the 75th, 50th and 25th percentiles of the y variable at each x value.
legend_title. String, legend title. Default = = c('75th', '50th', '25th').
legend_pos. String, legend position. Default = "right".
font_size. Overall font size. Default = 14. The font size of the axes and legend text is a fraction of this value.
inst/examples/ex-mk_percentileplot_convars.R
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.