teunbrand/ggh4x

Text aesthetics in nested facets not working

Closed this issue · 2 comments

I'm attempting to adjust the text appearance in nested facets, and it doesn't seem to be working. Using the graph from the main vignette with the iris dataset, when I add these theme calls to the main graph g:

g + theme(ggh4x.axis.nesttext.x = element_text(color = "dodgerblue4", size = rel(1.5)), ggh4x.facet.nestline = element_line(colour = "dodgerblue4"))

I see a blue line between "Long Leaves" (top row) and "versicolor" and "virginica" (2nd row) but no line between "Short Leaves" (top row) and "setosa" (2nd row). I also don't see any changes to the text: It's still black instead of blue and the size is the same. Here's the graph.

Am I doing something wrong?

Pretty happy to see these ggplot2 hacks, so thanks for developing this!

I see a blue line between "Long Leaves" (top row) and "versicolor" and "virginica" (2nd row) but no line between "Short Leaves" (top row) and "setosa" (2nd row).

Yes that should be correct, there is no nesting to indicate when there is a 1:1 correspondence between inner and outer strips. You can set facet_nested(..., solo_line = TRUE) to draw a line anyway.

I also don't see any changes to the text: It's still black instead of blue and the size is the same.

That is because that theme element controls axis text, not strip text. To tweak the appearance of individual strips (or by layer) you can follow this piece of vignette, which also applies to facet_nested(strip = strip_nested(...)).

thanks for developing this!

Glad to see people find it useful!

Thank you very, very much for all of this! Everything is working now for me. It's fantastic! I love how much clearer my graphs are now that I can add a title to the facets.