Skip to content

Fix coord_map to allow switching axis position #3069

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

Merged
merged 5 commits into from
Jan 19, 2019

Conversation

karawoo
Copy link
Member

@karawoo karawoo commented Jan 15, 2019

Fixes #3042 by adding x.arrange and y.arrange as panel params that reflect the primary/secondary axes. The order of the axes list elements needed to be swapped because scale_x$axis_order() gives the top first, then the bottom.

@karawoo karawoo requested a review from clauswilke January 19, 2019 15:53
bottom = guide_axis(pos$x, panel_params$x.labels, "bottom", theme),
top = guide_axis(pos$x, panel_params$x.labels, "top", theme)
top = guide_axis(pos$x, panel_params$x.labels, "top", theme),
bottom = guide_axis(pos$x, panel_params$x.labels, "bottom", theme)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just wondering: Is there anything happening here other than changing the order of the two lines? Is there a reason to switch the order?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, scale_x$axis_order() returns which axis is primary and which is secondary in this order (e.g. "secondary" "primary" meaning the top axis is secondary and the bottom is primary), so for the subsetting in the next line to work, this list needs to follow the same order (which is also why I had to reorder the values in arrange <- panel_params$x.arrange %||% c("secondary", "primary"))

@karawoo karawoo merged commit 4c999f2 into tidyverse:master Jan 19, 2019
@lock
Copy link

lock bot commented Jul 18, 2019

This old issue has been automatically locked. If you believe you have found a related problem, please file a new issue (with reprex) and link to this issue. https://reprex.tidyverse.org/

@lock lock bot locked and limited conversation to collaborators Jul 18, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

coord_map(): moving y axis to the right does not move all axis elements
2 participants