-
Notifications
You must be signed in to change notification settings - Fork 5
Add cookbook examples for graphics #13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Add many new examples to the customLayout cookbook vignette: Base Graphics (7 examples): - Simple multi-panel layout with lay_new and lay_set - Asymmetric layout with different panel sizes - Combining rows and columns with lay_bind_row/lay_bind_col - Statistical summary dashboard for model diagnostics - Time series with annotation panel and correlation matrix - Pairs plot alternative with custom layout - Publication-ready figure with outer margins and panel labels ggplot2 Graphics (12 examples): - Basic ggplot2 multi-panel layout - Dashboard with header and different sized panels - Facet-like arrangement with independent scales - Inset plots showing zoomed regions - Combining different plot types (scatter, bar, density) - Multiple legends arrangement with cowplot - Heatmap with marginal summaries - Model comparison plot (linear vs quadratic) - Multi-dataset comparison - Creating a themed report layout - Annotated plot arrangement - Complex nested layout with lay_bind operations
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 56e2000ffa
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| # Layout: top density, main scatter with right density, bar chart | ||
| lay <- lay_new( | ||
| matrix(c(1, 1, 0, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use NA (not 0) for empty cells in lay_grid layout
This layout matrix is used with lay_grid(), which delegates to gridExtra::grid.arrange. grid.arrange treats NA as the marker for empty cells; 0 is interpreted as a grob index, so rendering this example will try to access grob 0 and error (or misplace grobs), causing the vignette chunk to fail when built. This is fine for base layout(), but for grid graphics you should replace the 0 with NA (and keep the grob list aligned with indices 1..n).
Useful? React with 👍 / 👎.
| # Layout | ||
| lay <- lay_new( | ||
| matrix(c(1, 2, | ||
| 3, 0), ncol = 2, byrow = TRUE), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Avoid 0 in grid layout_matrix; it breaks lay_grid
This example uses lay_grid() with a layout matrix that includes 0 as an “empty” slot. gridExtra::grid.arrange expects NA for blank cells; 0 is treated as an index, so this chunk will attempt to place grob 0 (and fail), especially during vignette builds. Use NA for the empty cell and drop the placeholder NULL grob so the list indices match only the numbered cells.
Useful? React with 👍 / 👎.
✅ R CMD check: Check passedCommit:
Duration: 2m 36s Click to expand full R CMD check outputPowered by R Check Bot |
Add many new examples to the customLayout cookbook vignette:
Base Graphics (7 examples):
ggplot2 Graphics (12 examples):