Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit aa9dcb7

Browse filesBrowse files
authored
Fix ordering of lines in stat_ecdf() (#2065)
1 parent 35f9039 commit aa9dcb7
Copy full SHA for aa9dcb7

File tree

3 files changed

+19
-0
lines changed
Filter options

3 files changed

+19
-0
lines changed

‎NEWS.md

Copy file name to clipboardExpand all lines: NEWS.md
+4Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@
55
* `ggplotly()` now supports the `{ggalluvial}` package. (#2061, @moutikabdessabour)
66
* `ggplotly()` does not issue warnings with `options(warnPartialMatchArgs = TRUE)` any longer. (#2046, @bersbersbers)
77

8+
## Bug fixes
9+
10+
* `ggplotly()` now converts `stat_ecdf()` properly. (#2065)
11+
812
# 4.10.0
913

1014
## Breaking changes in JavaScript API

‎R/layers2traces.R

Copy file name to clipboardExpand all lines: R/layers2traces.R
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,7 @@ to_basic.GeomLine <- function(data, prestats_data, layout, params, p, ...) {
252252

253253
#' @export
254254
to_basic.GeomStep <- function(data, prestats_data, layout, params, p, ...) {
255+
data <- data[order(data[["x"]]), ]
255256
prefix_class(data, "GeomPath")
256257
}
257258

‎tests/testthat/test-ggplot-step.R

Copy file name to clipboardExpand all lines: tests/testthat/test-ggplot-step.R
+14Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,17 @@ test_that("direction vhv is translated to shape=vhv", {
3434
expect_equivalent(length(L$data), 2)
3535
expect_identical(L$data[[1]]$line$shape, "vhv")
3636
})
37+
38+
39+
test_that("`stat_ecdf` renders correctly", {
40+
df <- data.frame(
41+
x = c(rnorm(100, 0, 3), rnorm(100, 0, 10)),
42+
g = gl(2, 100)
43+
)
44+
45+
p <- ggplot(df, aes(x)) + stat_ecdf(geom = "step")
46+
expect_doppelganger(ggplotly(p), "step-ecdf")
47+
48+
p <- ggplot(df, aes(x, colour = g)) + stat_ecdf()
49+
expect_doppelganger(ggplotly(p), "step-ecdf-multiple")
50+
})

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.