Repository navigation
Add a dashboard app for the figure - #5
Merged
Merged
Conversation
app/app.R is a Shiny (bslib) app that builds the figure with the functions in R/figure.R. The sidebar exposes the settings from figure_defaults(): font size, panels, the two group colours, the panel B model and inset switches, the panel C jitter, the panel D constant and dashed lines, the panel E decay constants and band, and the panel F palette, plus a reset button. Tabs show the full figure, one panel at a larger size, and an about page. The figure downloads as PNG (96, 150 or 300 dpi) or SVG. The figure is always drawn at the script's fixed size, since the insets in panels B and D are placed for it. The panel tab draws the panel in its cell of the 3 x 2 layout and trims the empty space, so it matches the figure. Each panel is rebuilt only when one of its own settings changes. The app runs as is under Shinylive (webR): no cairo devices (they crash in webR once magick is loaded) and an explicit bindCache() cache (Shinylive sets up no default one). tests/testthat/test-app.R checks the server logic with testServer(): defaults, settings reaching the panels, panel selection, messages for invalid settings, the panel tab and both downloads. shiny, bslib and ragg are added to Suggests so CI installs them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds
app/, a Shiny app where you can change the figure's settings and download the result. It uses the plotting functions fromR/figure.R(#4), so the script and the app draw the same plots. Uploading your own data and deploying to GitHub Pages come in later PRs.The app
figure_defaults(), grouped by panel: font size, which panels to show, the two group colours, lognormal sigma and the inset/polygon switches (B), jitter seed and point opacity (C), the shear-stress constant and dashed lines (D), the decay constants and band width (E), and the viridis palette (F). A reset button restores the defaults. Invalid values (empty fields, a negative constant, no panel selected) show a message in place of the figure.Each panel is cached and rebuilt only when one of its own settings changes. The colour pickers are native
<input type="color">elements with a small input binding, so no extra package is needed.Shinylive (webR)
The plan is to host it on GitHub Pages with Shinylive, so R runs in the visitor's browser. I exported this branch with
shinylive::export()and drove it in headless Chromium. It works:magickis loaded, and passes an explicit cache tobindCache(), because Shinylive sets up no default one.Tests and dependencies
tests/testthat/test-app.Rchecks the server logic withshiny::testServer(): defaults, settings reaching the panels, panel selection, the validation messages, the panel tab, and both downloads (PNG pixel size per dpi). 91 tests pass locally.shiny,bslibandraggare added toSuggests, so CI installs them. The script itself doesn't need them.Run it locally with
shiny::runApp("app").🤖 Generated with Claude Code