You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
But if I add a nested facet, the "reference" data is moved to its own panel:
base+ggh4x::facet_nested(am~cyl+vs)
And note that this is not what ggplot2 does in this case
base+
facet_grid(am~cyl+vs)
(Although note that ggplot2 does draw phantom panels if one uses a global data (see: tidyverse/ggplot2#5356) although it draws the value of the facet, which ggh4x doesn't do.)
I'm doing this on purpose in nested facets, which is described in the details of ?facet_nested():
Unlike facet_grid(), this function only automatically expands missing variables when they have no variables in that direction, to allow for unnested variables. It still requires at least one layer to have all faceting variables.
The reason why this might be desirable is explained here.
To have the default facet_grid() behaviour, you can use the following:
Trying to solve other issues I found that
facet_nested()
behaves strangely in specific case.I'm trying to plot data belonging to a category as "reference" data in every panel and without getting a panel of its own. This seems to work:
Which is similar to ggplot2
s
facet_grid()`.But if I add a nested facet, the "reference" data is moved to its own panel:
And note that this is not what ggplot2 does in this case
(Although note that ggplot2 does draw phantom panels if one uses a global data (see: tidyverse/ggplot2#5356) although it draws the value of the facet, which ggh4x doesn't do.)
Created on 2023-07-19 with reprex v2.0.2
The text was updated successfully, but these errors were encountered: