-
Notifications
You must be signed in to change notification settings - Fork 636
Add ggalluvial support
#2044
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
Add ggalluvial support
#2044
Changes from 2 commits
c2621ac
5d8ce0a
5861f68
bdef939
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -613,6 +613,35 @@ to_basic.GeomQuantile <- function(data, prestats_data, layout, params, p, ...){ | |
| dat | ||
| } | ||
|
|
||
| #' @export | ||
| to_basic.GeomStratum <- function (data, ...) { | ||
| to_basic.GeomRect(data, ...) | ||
| } | ||
|
|
||
| #' @export | ||
| to_basic.GeomAlluvium <- function (data, ...) { | ||
| prefix_class(transform_alluvium(data), "GeomPolygon") | ||
| } | ||
|
|
||
| # tranform the alluvium data into the corresponding polygons | ||
| transform_alluvium <- function(data) { | ||
| data <- data[order(data$x), ] | ||
|
|
||
| if(unique(data$colour) == 0) data$colour <- NULL | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure what this is doing, but it seems you want
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Error in grDevices::col2rgb(x, alpha = TRUE) :
numerical color values must be positive
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This check needs to be more careful. If > if(c("a", "b") == 0) print("foo")
Warning message:
In if (c("a", "b") == 0) print("foo") :
the condition has length > 1 and only the first element will be used |
||
|
|
||
| unused_aes <- ! names(data) %in% c("x", "y", "ymin", "ymax") | ||
|
|
||
| row_number <- nrow(data) | ||
|
|
||
| data_rev <- data[nrow(data):1L, ] | ||
moutikabdessabour marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| structure(rbind( | ||
| cbind(x = data$x, y = data$ymin, data[unused_aes]), | ||
| cbind(x = data$x[row_number], y = data$ymin[row_number], data[row_number, unused_aes]), | ||
| cbind(x = data_rev$x, y = data_rev$ymax, data_rev[unused_aes]) | ||
| ), class = class(data)) | ||
| } | ||
|
|
||
| #' @export | ||
| to_basic.default <- function(data, prestats_data, layout, params, p, ...) { | ||
| data | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.