Coder Social home page Coder Social logo

Comments (9)

eliocamp avatar eliocamp commented on May 29, 2024 2

Sorry. I've been busy with other code. As soon as I come back to it, I'll try to reproduce it.

from ggh4x.

teunbrand avatar teunbrand commented on May 29, 2024

Hi Elio,

Thank you for bringing this to my attention.
I'm not entirely sure with how patchwork handles facets, but if I recall correctly from patchwork's author's tweets it has been quite an effort to make patchwork work for grobs that span multiple gtable cells. The way facet_nested() nests the facet strips is to have strips spanning multiple cells in the gtable.
I'd have to delve a bit deeper into how patchwork handles the facet bits and see if I could come up with a strategy that would make the two compatible and where a bugfix might be most appropriate.

P.S.: love the ggnewscale package

from ggh4x.

eliocamp avatar eliocamp commented on May 29, 2024

Thomas commented on that issue.

Yes. Patchwork makes some assumptions about facets in order to be able to align them properly. I have yet to formalise a description of these assumptions to guide facet extension developers but this should of course be done

It seems like any fix made now could be broken in the future, but maybe some temporary workaround could be useful.

PS: Thanks! And I love facet_nested()!

from ggh4x.

teunbrand avatar teunbrand commented on May 29, 2024

I think this might be fixed now. I haven't exhaustively tested all interactions with patchwork but the following should work:

library(ggh4x)
#> Loading required package: ggplot2
library(patchwork)

df <- iris
df$nester <- ifelse(df$Species == "setosa",
                    "Short Leaves",
                    "Long Leaves")

g <- ggplot(df, aes(Sepal.Length, Petal.Length)) +
  geom_point()
g1 <- g + facet_nested(nester + Species ~ .)
g2 <- g + facet_nested(~ nester + Species)

g1 + g2

Created on 2020-03-17 by the reprex package (v0.3.0)

Please let me know if you stumble upon any bugs with this fix!

from ggh4x.

teunbrand avatar teunbrand commented on May 29, 2024

Found out that it now has a weird interaction with force_panelsizes(), might need to fix some more. Posted as seperate issue in #6

from ggh4x.

eliocamp avatar eliocamp commented on May 29, 2024

I'm still getting an error (Error in grid.Call.graphics(C_setviewport, vp, TRUE) : invalid 'layout.pos.col') in my plots, but not in the minimal example I posted in the patchwork issue.
I'll try to get a mini reprex working.

from ggh4x.

teunbrand avatar teunbrand commented on May 29, 2024

Hey @eliocamp,

I've messed with the strip code while trying to fix issue #6.
I had hoped that it would also fix your error, but since I don't know how to reproduce it, it would be nice if either you could provide a reprex, or check if your error is fixed now.

Thanks in advance!

from ggh4x.

teunbrand avatar teunbrand commented on May 29, 2024

I'm going to consider this issue closed for now, but will reopen if a reprex can be found.

from ggh4x.

teunbrand avatar teunbrand commented on May 29, 2024

No worries, don't feel obligated or pressured. I'm not in a hurry

from ggh4x.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.