A basic SuperPlot
Example data from the original paper is included in the package.
We’ll use this for demonstration. The data is called
lord_jcb. A basic SuperPlot can be generated with the
following code:
library(SuperPlotR)
superplot(lord_jcb, "Speed", "Treatment", "Replicate", ylab = "Speed (µm/min)")
This will generate a SuperPlot of the Speed data, with
Treatment on the x-axis and Replicate is used
to group the data. The y-axis label is set to “Speed (µm/min)”.
An equivalent call in long form is:
superplot(
df = lord_jcb,
meas = "Speed",
cond = "Treatment",
repl = "Replicate",
ylab = "Speed (µm/min)"
)
To generate your own SuperPlot, you need a data frame with at least three columns (the measurement, the experimental condition, the experimental replicate).
Customising the SuperPlot
The major customisation options are shown here. See the other guides for other customisation options.
Data distribution
The underlying data can be rendered as violins,
superplot(lord_jcb, "Speed", "Treatment", "Replicate",
ylab = "Speed (µm/min)", datadist = "violin")
or with a jittered scatter plot, the default (shown in the first
example on this page) uses sina which is a jittered scatter
plot with a density estimate.
superplot(lord_jcb, "Speed", "Treatment", "Replicate",
ylab = "Speed (µm/min)", datadist = "jitter")
Summary points
The mean of each replicate is shown by default. You can show the median instead
superplot(lord_jcb, "Speed", "Treatment", "Replicate",
ylab = "Speed (µm/min)", rep_summary = "rep_median")
Bars
The default SuperPlot includes bars to indicate the mean ± sd. They
can be modified by using the bars argument. Options
are:
-
"mean_sd"= mean ± standard deviation -
"mean_sem"= mean ± standard error of the mean -
"mean_ci"= mean ± 95% confidence interval -
"none"= no error bars, but still show the mean with a crossbar -
""= no bars and no crossbar
Note that these bars show the mean ± error of the replicate means not the underlying data points.
# remove bars
superplot(lord_jcb, "Speed", "Treatment", "Replicate",
ylab = "Speed (µm/min)", bars = "")
Data point shapes
By default, all data points are circles. If you want to use different
shapes for different conditions, you can use the shapes
argument. Set to TRUE to use different shapes for each
replicate.
superplot(lord_jcb, "Speed", "Treatment", "Replicate",
ylab = "Speed (µm/min)", shapes = TRUE)
If you’d like to link the summary points, set
linking = TRUE.
superplot(lord_jcb, "Speed", "Treatment", "Replicate",
ylab = "Speed (µm/min)", linking = TRUE)
Linkages can be made when there are more than two groups. To demonstrate this we will use some toy data:
set.seed(123)
example <- data.frame(meas = rep(rep(c(10, 9, 6, 6), each = 25), 4) + rnorm(400),
cond = rep(rep(c("ctrl", "drug 1", "drug 2", "drug 3"), each = 25), 4),
expt = rep(c("exp1","exp2","exp3","exp4"), each = 100))
superplot(example, "meas", "cond", "expt",
linking = TRUE)
Saving the SuperPlot
The SuperPlot can be saved as a PDF or PNG file using the
ggsave function from the ggplot2 package.
More customisation
There are more options for customising SuperPlots. Look at the guides under the Articles tab.
Session Info
sessionInfo()
#> R version 4.6.1 (2026-06-24)
#> Platform: x86_64-pc-linux-gnu
#> Running under: Ubuntu 24.04.5 LTS
#>
#> Matrix products: default
#> BLAS: /usr/lib/x86_64-linux-gnu/openblas-pthread/libblas.so.3
#> LAPACK: /usr/lib/x86_64-linux-gnu/openblas-pthread/libopenblasp-r0.3.26.so; LAPACK version 3.12.0
#>
#> locale:
#> [1] LC_CTYPE=C.UTF-8 LC_NUMERIC=C LC_TIME=C.UTF-8
#> [4] LC_COLLATE=C.UTF-8 LC_MONETARY=C.UTF-8 LC_MESSAGES=C.UTF-8
#> [7] LC_PAPER=C.UTF-8 LC_NAME=C LC_ADDRESS=C
#> [10] LC_TELEPHONE=C LC_MEASUREMENT=C.UTF-8 LC_IDENTIFICATION=C
#>
#> time zone: UTC
#> tzcode source: system (glibc)
#>
#> attached base packages:
#> [1] stats graphics grDevices utils datasets methods base
#>
#> other attached packages:
#> [1] ggplot2_4.0.3 SuperPlotR_0.2.3
#>
#> loaded via a namespace (and not attached):
#> [1] gtable_0.3.6 jsonlite_2.0.0 dplyr_1.2.1 compiler_4.6.1
#> [5] tidyselect_1.2.1 jquerylib_0.1.4 systemfonts_1.3.2 scales_1.4.0
#> [9] textshaping_1.0.5 yaml_2.3.12 fastmap_1.2.0 ColorNameR_0.1.0
#> [13] R6_2.6.1 labeling_0.4.3 generics_0.1.4 knitr_1.52
#> [17] MASS_7.3-65 polyclip_1.10-7 tibble_3.3.1 desc_1.4.3
#> [21] bslib_0.12.0 pillar_1.11.1 RColorBrewer_1.1-3 rlang_1.3.0
#> [25] cachem_1.1.0 xfun_0.62 fs_2.1.0 sass_0.4.10
#> [29] S7_0.2.2 otel_0.2.0 cli_3.6.6 withr_3.0.3
#> [33] tweenr_2.0.3 pkgdown_2.2.1 magrittr_2.0.5 digest_0.6.39
#> [37] grid_4.6.1 ggforce_0.5.0 cowplot_1.2.0 lifecycle_1.0.5
#> [41] vctrs_0.7.3 evaluate_1.0.5 glue_1.8.1 farver_2.1.2
#> [45] ragg_1.5.2 rmarkdown_2.32 tools_4.6.1 pkgconfig_2.0.3
#> [49] htmltools_0.5.9