Skip to content

Commit b84a4fe

Browse files
committed
Merge pull request #344 from ropensci/fix/box-fill
fix #286
2 parents 1993631 + e874394 commit b84a4fe

File tree

4 files changed

+25
-4
lines changed

4 files changed

+25
-4
lines changed

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Package: plotly
22
Title: Create Interactive Web Graphics via Plotly's JavaScript Graphing Library
3-
Version: 2.0.12
3+
Version: 2.0.13
44
Authors@R: c(person("Carson", "Sievert", role = c("aut", "cre"),
55
email = "[email protected]"),
66
person("Chris", "Parmer", role = c("aut", "cph"),

NEWS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
2.0.13 -- 12 Dec 2015
2+
3+
Fix #286
4+
15
2.0.12 -- 11 Dec 2015
26

37
Fix #221

R/trace_generation.R

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -354,10 +354,10 @@ toBasic <- list(
354354
group2NA(g, "path")
355355
},
356356
boxplot=function(g) {
357-
# Preserve default colour values usign fill:
357+
# Preserve default colour values using fill:
358358
if (!is.null(g$data$fill)) {
359-
levels(g$prestats.data$fill) <- g$data$fill
360-
g$prestats.data$fill <- as.character(g$prestats.data$fill)
359+
g$prestats.data$fill <- NULL
360+
g$prestats.data <- plyr::join(g$prestats.data, g$data[c("x", "fill")], by = "x")
361361
}
362362
g$data <- g$prestats.data
363363
g

tests/testthat/test-ggplot-boxplot.R

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,20 @@ test_that("you can make a boxplot for a distribution of datetimes", {
4242
expect_identical(L$data[[1]]$type, "box")
4343
expect_identical(L$data[[1]]$y, as.character(df$y))
4444
})
45+
46+
dat <- data.frame(
47+
cond = factor(rep(c("A", "B", "C", "D"), each = 200)),
48+
col = factor(rep(c("C1", "C2"), each = 400)),
49+
rating = c(rnorm(200), rnorm(200, mean=.8), rnorm(200, mean=.4), rnorm(200, mean=.2))
50+
)
51+
g <- ggplot(dat, aes(x = cond, y = rating)) +
52+
geom_boxplot(outlier.shape = NA, aes(fill = col))
53+
54+
test_that("correct # of unique fillcolors", {
55+
L <- save_outputs(g, "boxplot-fillcolor")
56+
expect_equal(length(L$data), 4)
57+
expect_identical(L$data[[1]]$type, "box")
58+
fills <- sapply(L$data, "[[", "fillcolor")
59+
expect_equal(length(unique(fills)), length(unique(dat$col)))
60+
})
61+

0 commit comments

Comments
 (0)