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

facet_grid style strip #17

Open
kongdd opened this issue Oct 21, 2019 · 6 comments
Open

facet_grid style strip #17

kongdd opened this issue Oct 21, 2019 · 6 comments

Comments

@kongdd
Copy link

kongdd commented Oct 21, 2019

How can I make a ggplot facet_grid style strip when using levelplot?

@kongdd kongdd closed this as completed Oct 21, 2019
@sciencepeak
Copy link

sciencepeak commented Oct 13, 2021

This is a good question. Why do you close the issue?
In my opinion, ggplot2's facet_grid style should be a compelling feature for the lattice package.

@m-jahn
Copy link

m-jahn commented Oct 13, 2021

Maybe be more specific about the original question. From what I can see has lattice the same functionality as facet_grid, by using conditioning variables in combination with the layout argument. If you use two variables, it will arrange the number of rows and columns appropriately. If you want strips outside, you need useOuterStrips from latticeExtra, like this:

library(lattice)
library(dplyr)

# strips on top
xyplot(mpg ~ wt | gear * cyl, mtcars)

# strips on top and side
xyplot(mpg ~ wt | gear * cyl, mtcars) %>%
  latticeExtra::useOuterStrips()

Rplot

@deepayan
Copy link
Owner

Yes, in hindsight, the strips should have gone on the right instead of left, but otherwise, I don't think there's much else that can be done.

@sciencepeak
Copy link

Thanks a lot for the amazing illustration of functionality of facet_grid() style in the plot.

I found that in latticeExtra::useOuterStrips() paramters, there is only strip.left. Could you please consider adding parameters such as strip.right, or even strip.top, strip.bottom, etc., if this is not a hard work? In facet_grid(), the strips can be at any side of the graph.

@deepayan
Copy link
Owner

That's not difficult in principle, but will involve some careful and tedious coding. I will reopen this issue so it stays on my TODO list.

@deepayan deepayan reopened this Oct 16, 2021
@sciencepeak
Copy link

You are so nice. Thanks a lot for your contribution.

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

4 participants