-
Notifications
You must be signed in to change notification settings - Fork 633
subplot() should bump xref/yref axis references #1019
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
Comments
Shapes are automatically scaled/repositioned if you're using paper coordinates, for example: rect <- list(
type = "rect",
xref = "paper", yref = "paper",
x0 = 0.5, x1 = 0.6,
y0 = 0.5, y1 = 0.6
)
p1 <- layout(plot_ly(), shapes = rect)
subplot(p1, p1) I'm not sure if it generally makes sense to something similar for non-paper coordinates. |
That is a good tip to generate workarounds. So thanks for that. But people like to annotate their graphs in their "domain" coordinates, not the least because they do not actually have access to the "paper" coordinates when they are creating the plot. And if there is a well-defined mapping always available to the plotly when generating the plot, why shouldn't plotly just do the coordinate transformation? Is there a downside? |
Ok, after some more thought, I can see how this is useful. In this example, for instance, the library(plotly)
library(dplyr)
mtcars %>%
group_by(vs) %>%
do(
p = plot_ly(., x = ~wt, y = ~mpg) %>%
layout(shapes = list(
type = "rect", x0 = ~min(wt), x1 = ~max(wt), y0 = ~min(mpg), y1 = ~max(mpg)
))
) %>%
subplot() |
Closed via #1332 |
It is pretty well described in this StackOverflow post, and in my answer to it there: post. Do you need me to copy the information here as well?
There seem to be a number of bugs exposed there, maybe related, maybe not.
The text was updated successfully, but these errors were encountered: