Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@ R/.Rhistory
Rapp.history
/Karthik_local.R
*~
.Rhistory
.Rhistory
.RData
Makefile
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: plotly
Type: Package
Title: Interactive, publication-quality graphs online.
Version: 0.5.4
Version: 0.5.5
Authors@R: c(person("Chris", "Parmer", role = c("aut", "cre"),
email = "chris@plot.ly"),
person("Scott", "Chamberlain", role = "aut",
Expand Down
4 changes: 4 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
0.5.5 -- 24 October 2014.

Support category histograms (with factors).

0.5.4 -- 22 October 2014.

Support conversion of geom_vline().
Expand Down
7 changes: 4 additions & 3 deletions R/trace_generation.R
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ layer2traces <- function(l, d, misc) {
barmode <- "group"
if (g$geom == "bar" || g$geom == "histogram") {
if (l$stat$objname == "bin") {
bargap <- 0
if (g$geom != "histogram") {
warning("You may want to use geom_histogram.")
}
Expand Down Expand Up @@ -67,13 +66,15 @@ layer2traces <- function(l, d, misc) {
"%Y-%m-%d %H:%M:%S")
} else if (inherits(data.vec, "factor")) {
## Re-order data so that Plotly gets it right from ggplot2.
g$data <- g$data[order(g$data[[a]]),]
g$data <- g$data[order(g$data[[a]]), ]
data.vec <- data.vec[match(g$data[[a]], as.numeric(data.vec))]
g$prestats.data <- g$prestats.data[order(g$prestats.data[[a]]),]
g$prestats.data <- g$prestats.data[order(g$prestats.data[[a]]), ]
pdata.vec <- pdata.vec[match(g$prestats.data[[a]],
as.numeric(pdata.vec))]
if (length(pdata.vec) == length(data.vec))
pdata.vec <- data.vec
if (!is.factor(pdata.vec))
pdata.vec <- g$prestats.data[[paste0(a, ".name")]]
}
g$data[[a]] <- data.vec
g$prestats.data[[a]] <- pdata.vec
Expand Down
3 changes: 3 additions & 0 deletions tests/testthat/test-ggplot-histogram.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ test_that("default position is translated to barmode=stack", {
L <- gg2list(hist)
expect_equal(length(L), 2)
expect_identical(L$kwargs$layout$barmode, "stack")
expect_identical(L$kwargs$layout$xaxis$type, "category")
expect_identical(L[[1]]$type, "histogram")
expect_true(L[[1]]$x[1] %in% c("CDN", "MEX", "USA"))

save_outputs(hist, "histogram-barmodestack")
})
Expand Down