Skip to content

Commit 5f026f2

Browse files
committed
v 0.1.1 bars as default, docs improved
1 parent fb42c3c commit 5f026f2

12 files changed

Lines changed: 109 additions & 41 deletions

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Package: SuperPlotR
22
Title: Making SuperPlots in R
3-
Version: 0.1.0
3+
Version: 0.1.1
44
Authors@R:
55
person(given = "Stephen J",
66
family = "Royle",

NAMESPACE

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,11 @@
22

33
export(add_sp_bars)
44
export(flatplot)
5+
export(get_fp_color)
6+
export(get_fp_colors)
57
export(get_fp_colour)
68
export(get_fp_colours)
9+
export(get_sp_colors)
710
export(get_sp_colours)
811
export(get_sp_shapes)
912
export(get_sp_stats)

NEWS.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# SuperPlotR
22

3+
## SuperPlotR 0.1.1
4+
5+
* Use of mean ± sd bars is now the default
6+
* Minor changes to colour handling and documentation
7+
38
## SuperPlotR 0.1.0
49

510
* Test structure added. Bumping to 0.1.0 to reflect this change.

R/flatplot.R

Lines changed: 25 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,18 @@
11
#' Make a FlatPlot
22
#'
3+
#' @description
4+
#' The function \code{flatplot} creates a FlatPlot using \code{ggplot2}.
5+
#' A FlatPlot is a simplified version of a SuperPlot that does not require
6+
#' replicate information
7+
#'
38
#' @param df data frame with at least three columns: meas, cond, repl
49
#' @param meas character name of column with measurement (e.g. intensity)
510
#' @param cond character name of column with condition (e.g. Control, WT)
11+
#' @param repl not required for FlatPlot, but included for consistency with SuperPlot; can be set to NULL
612
#' @param colour string for colour palette to use, select ("rl_green", "rl_red",
713
#' "rl_blue", "rl_purple", "rl_orange", "rl_magenta", or a hex colour, default
814
#' is black)
15+
#' @param color valid alternative spelling of colour
916
#' @param xlab string for x label (default is empty)
1017
#' @param ylab string for y label (default is "Measurement")
1118
#' @param datadist string for data distribution to use, select ("sina" default,
@@ -34,19 +41,26 @@
3441
#' flatplot(lord_jcb, "Speed", "Treatment", ylab = "Speed (um/min)")
3542
#'
3643
flatplot <- function(df,
37-
meas, cond,
38-
colour = "#000000",
39-
xlab = "", ylab = "Measurement",
40-
datadist = "sina",
41-
size = 2,
42-
alpha = 0.5,
43-
bars = "mean_sd",
44-
fsize = 12,
45-
gg = NULL,
46-
stats = FALSE,
47-
stats_test = "para_unpaired") {
44+
meas, cond, repl = NULL,
45+
colour = "#000000",
46+
color = NULL, # for American users who might use color instead of colour
47+
xlab = "", ylab = "Measurement",
48+
datadist = "sina",
49+
size = 2,
50+
alpha = 0.5,
51+
bars = "mean_sd",
52+
fsize = 12,
53+
gg = NULL,
54+
stats = FALSE,
55+
stats_test = "para_unpaired") {
4856
ncond <- nrepl <- NULL
4957
rep_mean <- rep_median <- NULL
58+
if (!is.null(color)) {
59+
colour <- color
60+
}
61+
if (!is.null(repl)) {
62+
warning("repl argument is not used in flatplot and will be ignored")
63+
}
5064

5165
# validate args
5266
validate_args(colour = colour, xlab = xlab, ylab = ylab, datadist = datadist,

R/superplot.R

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,37 @@
11
#' Make a SuperPlot
22
#'
3+
#' @description
4+
#' The function \code{superplot} creates a SuperPlot using \code{ggplot2}.
5+
#'
36
#' @param df data frame with at least three columns: meas, cond, repl
47
#' @param meas character name of column with measurement (e.g. intensity)
58
#' @param cond character name of column with condition (e.g. Control, WT)
69
#' @param repl character name of column with replicate (e.g. unique experiment
7-
#' identifiers)
10+
#' identifiers)
811
#' @param pal name of colour palette to use (default is "tol_bright")
912
#' @param xlab string for x label (default is empty)
1013
#' @param ylab string for y label (default is "Measurement")
1114
#' @param datadist string for data distribution to use, select ("sina" default,
12-
#' "jitter", or "violin")
15+
#' "jitter", or "violin")
1316
#' @param size numeric vector of size range data and summary points (default is
14-
#' c(2, 3))
17+
#' c(2, 3))
1518
#' @param alpha numeric vector of alpha range data and summary points (default
16-
#' is c(0.5, 0.7))
17-
#' @param bars string for type of error bars to add, select ("none" default,
18-
#' "mean_sd", "mean_sem", or "mean_ci")
19+
#' is c(0.5, 0.7))
20+
#' @param bars string for type of error bars to add, select "mean_sd" (default),
21+
#' "mean_sem", or "mean_ci"; for no bars use an empty string (""); for no
22+
#' error bars but still show the mean with a crossbar, use "none".
1923
#' @param linking logical for whether to link summary points between conditions
20-
#' (default is FALSE)
24+
#' (default is FALSE)
2125
#' @param fsize numeric font size for text (default is 12)
2226
#' @param shapes logical for whether to use different shapes for replicates
2327
#' @param rep_summary string for summary statistic to use for replicates, select
24-
#' ("rep_mean" default, or "rep_median")
28+
#' ("rep_mean" default, or "rep_median")
2529
#' @param gg ggplot object to add to (default is NULL)
2630
#' @param stats logical for whether to add statistical tests (default is FALSE)
2731
#' @param stats_test string for statistical test to use, select
28-
#' ("para_unpaired", "para_paired", "nonpara_unpaired", or "nonpara_paired")
32+
#' ("para_unpaired", "para_paired", "nonpara_unpaired", or "nonpara_paired")
2933
#' @param info logical for whether to print information about the plot (default
30-
#' is FALSE)
34+
#' is FALSE)
3135
#'
3236
#' @return ggplot object
3337
#' @import ggplot2
@@ -50,7 +54,7 @@ superplot <- function(df,
5054
datadist = "sina",
5155
size = c(2, 3),
5256
alpha = c(0.5, 0.7),
53-
bars = "",
57+
bars = "mean_sd",
5458
linking = FALSE,
5559
rep_summary = "rep_mean",
5660
shapes = FALSE,

README.Rmd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ These columns are:
5959
2. the experimental condition,
6060
3. the experimental repeat that the measurment comes from.
6161

62-
The `superplot` function takes the data frame, the names of these three columns,
62+
The `superplot()` function takes the data frame, the names of these three columns,
6363
and is further customisable with additional arguments.
6464

6565
See `vignette("SuperPlotR")` for more examples, or

man/flatplot.Rd

Lines changed: 9 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/get_fp_colour.Rd

Lines changed: 12 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/get_fp_colours.Rd

Lines changed: 13 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/get_sp_colours.Rd

Lines changed: 13 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)