Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merging legends #97

Open
sinhrks opened this issue Jan 11, 2016 · 0 comments
Open

Merging legends #97

sinhrks opened this issue Jan 11, 2016 · 0 comments

Comments

@sinhrks
Copy link
Owner

sinhrks commented Jan 11, 2016

Looks possible but can't work well with current ggmultiplot as legend must be considered as plot (grob). Needs separated class to dot this, or logic to merge the same legends when output.

p <- autoplot(lm(Petal.Width ~ Petal.Length, data = iris), colour = 'Species', data = iris)

grob <- ggplotGrob(p@plots[[1]])
leg <- grob$grobs[[which(grob$layout$name == "guide-box")]]

plots <- lapply(p@plots, function(x) x + theme(legend.position = 'none'))
plots[[5]] <- leg

layout_matrix = rbind(c(1, 2, 5), c(3, 4, 5))
do.call(grid.arrange, c(plots, list(ncol = 3, layout_matrix = layout_matrix))

rplot

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

No branches or pull requests

1 participant