Open teng-gao opened 10 months ago
Thank you for your kind words. Your request is unfortunately not supported. I did not consider that feature to be relevant at the time. I am actually curious what your particular case is, where this is desirable.
I can offer some suggestions on how to solve it: 1) If y-axes are the same throughout all facets, but the x-axes change, you could simply use facet_wrap(scales="free_x").
2) Use facet_ret_grid as it is now, and then remove the unwanted y-axis grobs. Take a look at the vignette https://cran.r-project.org/web/packages/lemon/vignettes/gtable_show_lemonade.html You will need to render the ggplot2-object with ggplotGrob (this is what printing the ggplot2-object actually does): p <- ggplot(...) g <- ggplotGrob(p)
Use the function gtable_show_names to find the names of the grobs and find their position (rownumber) in the layout-table (g$layout). Replace these positions in g$grobs with zeroGrob().
Finally (optional), reduce the spacing induced by the y-axes.
Behind the scene, the ggplot-grob positions all the plot's elements (title,
axis, plot-area) in a grid. This is what g$layout describes.
Find the names of the axis-components in g$layout, and take note of their
left-coordinate (the l
-column).
The widths of each column is stored in g$widths, ordered left to right.
Replace the relevant positions with unit(0, "npc").
You then print with grid::grid.newpage() grid::grid.draw(g)
Kind, Stefan
Den tirs. 22. aug. 2023 kl. 03.05 skrev Teng Gao @.***>:
Hi,
Thanks for the useful package. How do I only repeat x axis in facet_rep_grid but not y?
— Reply to this email directly, view it on GitHub https://github.com/stefanedwards/lemon/issues/31, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA3NBGXXF2QOXIZDDPMSOFDXWQAUNANCNFSM6AAAAAA3ZER2PU . You are receiving this because you are subscribed to this thread.Message ID: @.***>
Hi,
Thanks for the useful package. How do I only repeat x axis in facet_rep_grid but not y?