View source: R/marginal_plot.R
plot_scat2 | R Documentation |
plot_scat2
produces scatterplots for 2 marginal distributions.
The scatterplots are jittered using geom_quasirandom
.
plot_scat2(data = df, formula = obs ~ gr, xlabel = NULL, ylabel = NULL, ...)
data |
A data frame in long format. One column is a factor describing the groups;
another column contains the values/observations for each group. A properly formatted data
frame can be created using |
formula |
A formula with format response variable ∼ predictor variable, where ~ (tilde) means "is modeled as a function of". |
xlabel |
Option to set different name - default NULL to use data frame column names. |
ylabel |
Option to set different name - default NULL to use data frame column names. |
... |
Input arguments for ggbeeswarm::geom_quasirandom |
A ggplot object.
# generate data set.seed(21) g1 <- rnorm(1000) + 6 g2 <- rnorm(1000) * 1.5 + 6 # make tibble df <- mkt2(g1, g2) # make scatterplots ps <- plot_scat2(data = df, formula = obs ~ gr, xlabel = "", ylabel = "Scores (a.u.)", alpha = 1, shape = 21, colour = "grey10", fill = "grey90") # scatterplots ps <- ps + coord_flip() ps
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.