View source: R/marginal_plot.R
plot_scat2d | R Documentation |
Scatterplot of paired observations with reference line of no effect. Quartiles of each condition are superimposed. Quartiles are estimated using the Harrell-Davis estimator.
plot_scat2d( df = df, formula = cond2 ~ cond1, min.x = NA, min.y = NA, max.x = NA, max.y = NA, axis.steps = 2, size_p = 5, stroke_p = 1, shape_p = 21, colour_p = "black", fill_p = "#ffb347", alpha_p = 0.5, linetype_q = "dashed", size_q = 1, alpha_q = 0.5, colour_q = "black" )
df |
Data frame with paired observations in two columns. |
formula |
A formula with format response variable ∼ predictor variable, where ~ (tilde) means "is modeled as a function of". |
min.x, min.y, max.x, max.y |
Specify axis limits - default square axes |
axis.steps |
Steps between x and y tick marks - default = 2. |
size_p |
Size parameter of the scatterplot - default = 5. |
stroke_p |
Stroke parameter of the scatterplot - default = 1, |
shape_p |
Shape parameter of the scatterplot - default = 21, |
colour_p |
Colour parameter of the scatterplot - default = "black", |
fill_p |
Fill parameter of the scatterplot - default = "#ffb347", |
alpha_p |
Alpha parameter of the scatterplot - default = .5, |
linetype_q |
Linetype of the segments marking the quartiles - default = "dashed", |
size_q |
Size of the segments marking the quartiles - default = 1, |
alpha_q |
Alpha of the segments marking the quartiles - default = .5, |
colour_q |
Colour of the segments marking the quartiles - default = "black" |
hd
df <- tibble(cond1 = rnorm(50), cond2 = cond1 + rnorm(50)) plot_scat2d(df, formula = cond2 ~ cond1) # basic call plot_scat2d(df, formula = cond2 ~ cond1, size_q=3) # specify size of quartile segments plot_scat2d(df, formula = cond2 ~ cond1, size_q=c(1,2,1)) # use thicker line for median plot_scat2d(df, formula = cond2 ~ cond1, linetype_q = "longdash") # specify linetype - default = dashed
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.