Skip to content
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

fix legend justification for fixed aspect ratio plots #140

Merged
merged 1 commit into from
Jun 18, 2020
Merged

fix legend justification for fixed aspect ratio plots #140

merged 1 commit into from
Jun 18, 2020

Conversation

ilia-kats
Copy link
Contributor

On the current master branch, legend justification for fixed aspect ratio plots is broken:

library(ggplot2)
library(patchwork)
p1 <- ggplot(mtcars, aes(cyl, qsec, color=as.factor(vs))) +
    geom_point()
p2 <- p1 + labs(color="a very looooooong legend title")
p1 + p2 + plot_layout(ncol=1) & theme(legend.justification = "left", aspect.ratio=1)

Created on 2019-12-08 by the reprex package (v0.3.0)

This patch fixes this issue:

library(ggplot2)
library(patchwork)
p1 <- ggplot(mtcars, aes(cyl, qsec, color=as.factor(vs))) +
    geom_point()
p2 <- p1 + labs(color="a very looooooong legend title")
p1 + p2 + plot_layout(ncol=1) & theme(legend.justification = "left", aspect.ratio=1)

Created on 2019-12-08 by the reprex package (v0.3.0)

@thomasp85 thomasp85 merged commit e71ac7f into thomasp85:master Jun 18, 2020
@thomasp85
Copy link
Owner

Thanks !

@thomasp85
Copy link
Owner

hmm... it appears the fix in this pr no longer works... I'll have a look

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

Successfully merging this pull request may close these issues.

2 participants