Skip to content

avoid reordering axis categories when is a matrix; fixes #863 #898

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 24, 2017
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
2 changes: 1 addition & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ sorted alphabetically before scales are applied. Also, when mapping a factor to
* Misspecified trace/layout attributes produce a warning.
* New `plotly_data()` function for returning/inspecting data frame(s) associated with a plotly object.
* New `plotly_json()` function for inspecting the data sent to plotly.js (as an R list or JSON).
* `layout()` is now a generic function and uses method dispatch to avoid conflicts with `graphics:layout()` (fixes #464).
* `layout()` is now a generic function and uses method dispatch to avoid conflicts with `graphics::layout()` (fixes #464).

## OTHER CHANGES:

Expand Down
4 changes: 3 additions & 1 deletion R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -476,7 +476,9 @@ populate_categorical_axes <- function(p) {
d <- lapply(p$x$data, "[[", axisType)
isOnThisAxis <- function(tr) {
is.null(tr[["geo"]]) && sub("axis", "", axisName) %in%
(tr[[sub("[0-9]+", "", axisName)]] %||% axisType)
(tr[[sub("[0-9]+", "", axisName)]] %||% axisType) &&
# avoid reordering matrices (see #863)
!is.matrix(tr[["z"]])
}
d <- d[vapply(p$x$data, isOnThisAxis, logical(1))]
if (length(d) == 0) next
Expand Down