-
Notifications
You must be signed in to change notification settings - Fork 633
Plot margins #211
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
Whoops, I think this is related to the checkmark titled "add some more spacing around the graph: expand the range" here. |
For a plot with a single panel, layout(margin = ...) would be a solution, but what about multiple panels? |
And, more generally, we should be respecting the expand argument: qplot(1:10, 1:10)
# versus
qplot(1:10, 1:10) +
scale_x_continuous(expand = c(0,0)) +
scale_y_continuous(expand = c(0,0)) |
@cpsievert happy to help out on this since I ran into this issue - any pointers you might be able to provide before I jump in? |
The "proper" way to do this is probably going to change when the new version of ggplot2 hits. So, if you want to tackle this, I recommend working from our fix for the dev version of ggplot2. This will likely be merged within a month from now when the new ggplot2 hits CRAN. Right around here we start to translate axis information. Somewhere in there we need to set the proper range for each axis. Problem is, I'm not exactly sure the best way to find the range from the plot object. Once we have the proper ranges, it won't be hard to translate to plotly: p <- qplot(data = mtcars, mpg, geom = "density")
g <- plotly_build(p)
g$layout$xaxis <- modifyList(g$layout$xaxis, list(range = c(5, 50)))
g |
This should be fixed in f1900cc. |
As it appears on page 60 of Hadley's PhD thesis, there are perceptual issues with plotting data next to the margin in the plot. It goes on to say:
In plotly, we have the luxury of zooming/panning, but it'd be nice if we could match this default behaviour in ggplot2.
The text was updated successfully, but these errors were encountered: