Skip to content

y-axis range not set properly when facet_wrap(scales = "free_y") #166

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

Closed
cpsievert opened this issue Feb 17, 2015 · 3 comments
Closed

y-axis range not set properly when facet_wrap(scales = "free_y") #166

cpsievert opened this issue Feb 17, 2015 · 3 comments

Comments

@cpsievert
Copy link
Collaborator

This is related to the scales="free" bullet of #161, but is probably worth noting separately. I'll send a pull request in attempt to fix both. I've uploaded this plot to demonstrate a bug in the y-axis limits:

library("plotly")
no_panels <- ggplot(mtcars, aes(mpg, wt)) + geom_point()
no_panels + facet_wrap(~am+vs, scales = "free")

On a larger note, the package currently seems a little confused about the conceptual difference between facet_grid and facet_wrap in terms of free scales. For facet_grid, the y-axis/x-axis has to be fixed for a given row/column. But for facet_wrap, each panel is allowed to have it's own axis. I think this figure from the ggplot2 book helps demonstrate that:

position-facets

@chriddyp @mkcor do you know if the plotly API would support drawing an axis on each panel?

@chriddyp
Copy link
Member

hey @cpsievert -- I'm not too familiar with facet_* but Plotly 'panels' can share axes. in fact, plotly's axes are pretty flexible: you control the length of them and the position of them. there are some good simple docs here: https://plot.ly/r/subplots/. The "Multiple Subplots" example seems like facet_wrap and "Subplots with Shared Axes" more similar to facet_grid. Here's another good 3x3 facet_grid example:

@cpsievert
Copy link
Collaborator Author

Nice, just what I was looking for, thanks!

@mkcor
Copy link
Contributor

mkcor commented Feb 17, 2015

@cpsievert You are right, the conversion as is doesn't distinguish between facet_grid and facet_wrap in terms of free scales or column/row behaviour.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants