Skip to content

Commit 78e0461

Browse files
authored
Merge pull request #898 from ropensci/bugfix/axisOrder
avoid reordering axis categories when is a matrix; fixes #863
2 parents 8c5aff3 + 29238e5 commit 78e0461

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

NEWS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ sorted alphabetically before scales are applied. Also, when mapping a factor to
316316
* Misspecified trace/layout attributes produce a warning.
317317
* New `plotly_data()` function for returning/inspecting data frame(s) associated with a plotly object.
318318
* New `plotly_json()` function for inspecting the data sent to plotly.js (as an R list or JSON).
319-
* `layout()` is now a generic function and uses method dispatch to avoid conflicts with `graphics:layout()` (fixes #464).
319+
* `layout()` is now a generic function and uses method dispatch to avoid conflicts with `graphics::layout()` (fixes #464).
320320

321321
## OTHER CHANGES:
322322

R/utils.R

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -476,7 +476,9 @@ populate_categorical_axes <- function(p) {
476476
d <- lapply(p$x$data, "[[", axisType)
477477
isOnThisAxis <- function(tr) {
478478
is.null(tr[["geo"]]) && sub("axis", "", axisName) %in%
479-
(tr[[sub("[0-9]+", "", axisName)]] %||% axisType)
479+
(tr[[sub("[0-9]+", "", axisName)]] %||% axisType) &&
480+
# avoid reordering matrices (see #863)
481+
!is.matrix(tr[["z"]])
480482
}
481483
d <- d[vapply(p$x$data, isOnThisAxis, logical(1))]
482484
if (length(d) == 0) next

0 commit comments

Comments
 (0)