diff --git a/NAMESPACE b/NAMESPACE
index 84a7d50..5ac78f4 100644
--- a/NAMESPACE
+++ b/NAMESPACE
@@ -1,6 +1,7 @@
# Generated by roxygen2: do not edit by hand
export(pal_aaas)
+export(pal_bmj)
export(pal_cosmic)
export(pal_d3)
export(pal_flatui)
@@ -24,6 +25,7 @@ export(pal_ucscgb)
export(rgb_gsea)
export(rgb_material)
export(scale_color_aaas)
+export(scale_color_bmj)
export(scale_color_cosmic)
export(scale_color_d3)
export(scale_color_flatui)
@@ -45,6 +47,7 @@ export(scale_color_tron)
export(scale_color_uchicago)
export(scale_color_ucscgb)
export(scale_colour_aaas)
+export(scale_colour_bmj)
export(scale_colour_cosmic)
export(scale_colour_d3)
export(scale_colour_flatui)
@@ -66,6 +69,7 @@ export(scale_colour_tron)
export(scale_colour_uchicago)
export(scale_colour_ucscgb)
export(scale_fill_aaas)
+export(scale_fill_bmj)
export(scale_fill_cosmic)
export(scale_fill_d3)
export(scale_fill_flatui)
diff --git a/R/discrete-bmj.R b/R/discrete-bmj.R
index ef55b8a..38d53c3 100644
--- a/R/discrete-bmj.R
+++ b/R/discrete-bmj.R
@@ -1,11 +1,10 @@
-#' The BMJ Color Palettes
+#' BMJ Color Palettes
#'
-#' Color palette inspired by plots in
-#' \emph{The BMJ}.
+#' Color palette from the BMJ living style guide.
#'
#' @param palette Palette type.
#' Currently there is one available option: \code{"default"}
-#' (7-color palette).
+#' (9-color palette).
#' @param alpha Transparency level, a real number in (0, 1].
#' See \code{alpha} in \code{\link[grDevices]{rgb}} for details.
#'
@@ -15,12 +14,11 @@
#' @importFrom scales manual_pal
#'
#' @author Hui Chen <\email{huichen@@zju.edu.cn}>
-#' Modified from Nan Xiao's code on JAMA pallett
#'
#' @examples
#' library("scales")
-#' show_col(pal_bmj("default")(7))
-#' show_col(pal_bmj("default", alpha = 0.6)(7))
+#' show_col(pal_bmj("default")(9))
+#' show_col(pal_bmj("default", alpha = 0.6)(9))
pal_bmj <- function(palette = c("default"), alpha = 1) {
palette <- match.arg(palette)
@@ -37,7 +35,7 @@ pal_bmj <- function(palette = c("default"), alpha = 1) {
manual_pal(unname(alpha_cols))
}
-#' Journal of the American Medical Association Color Scales
+#' BMJ Color Scales
#'
#' See \code{\link{pal_bmj}} for details.
#'
@@ -48,8 +46,7 @@ pal_bmj <- function(palette = c("default"), alpha = 1) {
#'
#' @importFrom ggplot2 discrete_scale
#'
-#' @author Nan Xiao <\email{me@@nanx.me}> |
-#' <\href{https://nanx.me}{https://nanx.me}>
+#' @author Hui Chen <\email{huichen@@zju.edu.cn}>
#'
#' @rdname scale_bmj
#'
diff --git a/R/sysdata.rda b/R/sysdata.rda
index c8502e0..6864dc9 100644
Binary files a/R/sysdata.rda and b/R/sysdata.rda differ
diff --git a/README.Rmd b/README.Rmd
index bb01840..e22c62b 100644
--- a/README.Rmd
+++ b/README.Rmd
@@ -126,6 +126,14 @@ p2_jama <- p2 + scale_fill_jama()
grid.arrange(p1_jama, p2_jama, ncol = 2)
```
+### BMJ
+
+```{r, ggsci-bmj}
+p1_bmj <- p1 + scale_color_bmj()
+p2_bmj <- p2 + scale_fill_bmj()
+grid.arrange(p1_bmj, p2_bmj, ncol = 2)
+```
+
### JCO
```{r, ggsci-jco}
diff --git a/README.md b/README.md
index 3c11515..16ad466 100644
--- a/README.md
+++ b/README.md
@@ -55,6 +55,10 @@ open with `vignette("ggsci")` in R) for a quick-start guide.
+### BMJ
+
+
+
### JCO
diff --git a/_pkgdown.yml b/_pkgdown.yml
index 4d3b36d..da2e15f 100644
--- a/_pkgdown.yml
+++ b/_pkgdown.yml
@@ -36,6 +36,12 @@ reference:
- scale_color_jama
- scale_colour_jama
- scale_fill_jama
+ - title: "BMJ"
+ contents:
+ - pal_bmj
+ - scale_color_bmj
+ - scale_colour_bmj
+ - scale_fill_bmj
- title: "JCO"
contents:
- pal_jco
diff --git a/data-raw/data-generator.R b/data-raw/data-generator.R
index 2b3c558..3c164b5 100644
--- a/data-raw/data-generator.R
+++ b/data-raw/data-generator.R
@@ -49,16 +49,17 @@ ggsci_db$"jama"$"default" <- c(
"Makara" = "#80796B"
)
-# Color palette inspired by plots in BMJ (http://technology.bmj.com/living-style-guide/colour.html)
+# Color palette from BMJ living style guide
+# https://technology.bmj.com/living-style-guide/colour.html
ggsci_db$"bmj"$"default" <- c(
- "Blue" = "#2A6EBB",
- "Yellow" = "#F0AB00",
+ "Blue" = "#2A6EBB",
+ "Yellow" = "#F0AB00",
"Pink" = "#C50084",
- "Purple" = "#7D5CC6",
+ "Purple" = "#7D5CC6",
"Orange" = "#E37222",
"Green" = "#69BE28",
"Aqua" = "#00B2A9",
- "Red" = "#CD202C",
+ "Red" = "#CD202C",
"Grey" = "#747678"
)
@@ -521,7 +522,9 @@ test_barplot("futurama", "planetexpress")
test_barplot("rickandmorty", "schwifty")
test_barplot("simpsons", "springfield")
test_barplot("gsea", "default")
-test_barplot("flatuiau", "intense")
+test_barplot("flatui", "default")
+test_barplot("flatui", "flattastic")
+test_barplot("flatui", "aussie")
test_barplot("material", "red")
test_barplot("material", "pink")
test_barplot("material", "purple")
diff --git a/man/figures/README-ggsci-bmj-1.png b/man/figures/README-ggsci-bmj-1.png
new file mode 100644
index 0000000..5f22fde
Binary files /dev/null and b/man/figures/README-ggsci-bmj-1.png differ
diff --git a/man/pal_bmj.Rd b/man/pal_bmj.Rd
new file mode 100644
index 0000000..599dc8c
--- /dev/null
+++ b/man/pal_bmj.Rd
@@ -0,0 +1,27 @@
+% Generated by roxygen2: do not edit by hand
+% Please edit documentation in R/discrete-bmj.R
+\name{pal_bmj}
+\alias{pal_bmj}
+\title{BMJ Color Palettes}
+\usage{
+pal_bmj(palette = c("default"), alpha = 1)
+}
+\arguments{
+\item{palette}{Palette type.
+Currently there is one available option: \code{"default"}
+(9-color palette).}
+
+\item{alpha}{Transparency level, a real number in (0, 1].
+See \code{alpha} in \code{\link[grDevices]{rgb}} for details.}
+}
+\description{
+Color palette from the BMJ living style guide.
+}
+\examples{
+library("scales")
+show_col(pal_bmj("default")(9))
+show_col(pal_bmj("default", alpha = 0.6)(9))
+}
+\author{
+Hui Chen <\email{huichen@zju.edu.cn}>
+}
diff --git a/man/scale_bmj.Rd b/man/scale_bmj.Rd
new file mode 100644
index 0000000..489851e
--- /dev/null
+++ b/man/scale_bmj.Rd
@@ -0,0 +1,51 @@
+% Generated by roxygen2: do not edit by hand
+% Please edit documentation in R/discrete-bmj.R
+\name{scale_color_bmj}
+\alias{scale_color_bmj}
+\alias{scale_colour_bmj}
+\alias{scale_fill_bmj}
+\title{BMJ Color Scales}
+\usage{
+scale_color_bmj(palette = c("default"), alpha = 1, ...)
+
+scale_colour_bmj(palette = c("default"), alpha = 1, ...)
+
+scale_fill_bmj(palette = c("default"), alpha = 1, ...)
+}
+\arguments{
+\item{palette}{Palette type.
+Currently there is one available option: \code{"default"}
+(9-color palette).}
+
+\item{alpha}{Transparency level, a real number in (0, 1].
+See \code{alpha} in \code{\link[grDevices]{rgb}} for details.}
+
+\item{...}{additional parameters for \code{\link[ggplot2]{discrete_scale}}}
+}
+\description{
+See \code{\link{pal_bmj}} for details.
+}
+\examples{
+library("ggplot2")
+data("diamonds")
+
+ggplot(
+ subset(diamonds, carat >= 2.2),
+ aes(x = table, y = price, colour = cut)
+) +
+ geom_point(alpha = 0.7) +
+ geom_smooth(method = "loess", alpha = 0.1, size = 1, span = 1) +
+ theme_bw() +
+ scale_color_bmj()
+
+ggplot(
+ subset(diamonds, carat > 2.2 & depth > 55 & depth < 70),
+ aes(x = depth, fill = cut)
+) +
+ geom_histogram(colour = "black", binwidth = 1, position = "dodge") +
+ theme_bw() +
+ scale_fill_bmj()
+}
+\author{
+Hui Chen <\email{huichen@zju.edu.cn}>
+}
diff --git a/vignettes/ggsci.Rmd b/vignettes/ggsci.Rmd
index 99112e2..602abb0 100644
--- a/vignettes/ggsci.Rmd
+++ b/vignettes/ggsci.Rmd
@@ -70,6 +70,9 @@ summarized in the table below.
| JAMA | `scale_color_jama()` | `"default"` | `pal_jama()` |
| | `scale_fill_jama()` | | |
+-----------------+------------------------------+--------------------------------+----------------------+
+| BMJ | `scale_color_bmj()` | `"default"` | `pal_bmj()` |
+| | `scale_fill_bmj()` | | |
++-----------------+------------------------------+--------------------------------+----------------------+
| JCO | `scale_color_jco()` | `"default"` | `pal_jco()` |
| | `scale_fill_jco()` | | |
+-----------------+------------------------------+--------------------------------+----------------------+
@@ -215,6 +218,17 @@ p2_jama <- p2 + scale_fill_jama()
grid.arrange(p1_jama, p2_jama, ncol = 2)
```
+### BMJ
+
+The BMJ palette is from the
+[BMJ living style guide](https://technology.bmj.com/living-style-guide/colour.html):
+
+```{r}
+p1_bmj <- p1 + scale_color_bmj()
+p2_bmj <- p2 + scale_fill_bmj()
+grid.arrange(p1_bmj, p2_bmj, ncol = 2)
+```
+
### JCO
The JCO palette is inspired by the the plots in