Comments (9)
Sorry. I've been busy with other code. As soon as I come back to it, I'll try to reproduce it.
from ggh4x.
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.
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.
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.
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.
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.
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.
I'm going to consider this issue closed for now, but will reopen if a reprex can be found.
from ggh4x.
No worries, don't feel obligated or pressured. I'm not in a hurry
from ggh4x.
Related Issues (20)
- geom_polygonraster - grey lines between pixels HOT 4
- Release ggh4x 0.2.5
- `facet_nested()` adds "phantom" panels if there are nested facets. HOT 2
- `facet_nested()` doesn't work with factors if a layer doens't inclu HOT 4
- force_panelsizes: Allow `bigpts` as a valid unit for total_width and total_height HOT 3
- force_panelsizes and ggMarginal HOT 1
- help_secondary is not working properly with geom_col HOT 2
- Margins Error HOT 1
- Release ggh4x 0.2.6
- vertical lines as separator between categorical groups in nested axis HOT 3
- Adding color to the primary strip breaks the overlap HOT 2
- facet_grid2 produces extra axes ticks when hline/vline is added HOT 2
- Inner vs. outer panel spacing using `strip_nested()` HOT 1
- Error in legend$train when using "stringlegend" HOT 3
- scale_y_dendrogram() not displaying dendro with ggplotly() in shiny app HOT 1
- Possible to use expressions with guide_axis_nested()? HOT 2
- facet_grid2 error: could not fund "rbind_dfs" HOT 1
- Feature suggestion: facet_wrap2 all axes but axis text only once HOT 2
- How to add space around the nesting lines in `guide_axis_nested` HOT 2
- facet_nested incompatible with facetted_pos_scales? HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ggh4x.