Related to #6398 and #6396.
After testing, I found it difficult to handle the original feature request using a single Facet object alone, since the panels input to Facet$draw_panels() is unpredictable. It’s challenging to break down panels into individual layer grobs.
Several issues contribute to this unpredictability:
- The
Layer$draw_geom method doesn't always return a grob if the developer doesn’t follow the expected conventions. No error or warning is issued in such cases, and gList(NULL) or gList(gList()) simply works silently.
Coord$draw_panel will sometimes wrap all layer grobs into single gTree in CoordRadial, sometimes it won't
Solutions:
- Ensure that
Layer$draw_geom() always returns a single grob or a gTree.
- always wrap the all layer grobs into a single
gTree before passing to Coord$draw_panel
In this way, the input panels will always be a list of gTree object for each panel.
each gTree object contains 3 children for Coord$render_fg, Coord$render_bg and another gTree of Facet$draw_back, all layer grobs, and Facet$draw_front
Related to #6398 and #6396.
After testing, I found it difficult to handle the original feature request using a single Facet object alone, since the
panelsinput toFacet$draw_panels()is unpredictable. It’s challenging to break down panels into individual layer grobs.Several issues contribute to this unpredictability:
Layer$draw_geommethod doesn't always return a grob if the developer doesn’t follow the expected conventions. No error or warning is issued in such cases, andgList(NULL)orgList(gList())simply works silently.Coord$draw_panelwill sometimes wrap all layer grobs into single gTree inCoordRadial, sometimes it won'tSolutions:
Layer$draw_geom()always returns a singlegrobor agTree.gTreebefore passing toCoord$draw_panelIn this way, the input
panelswill always be a list ofgTreeobject for each panel.each
gTreeobject contains 3 children forCoord$render_fg,Coord$render_bgand anothergTreeofFacet$draw_back, all layer grobs, andFacet$draw_front