Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Enhance plot dimensions and simplify simulation plot facets#204

Closed
daattali wants to merge 6 commits into
masterfrom
feat-simplify-plot-facets
Closed

Enhance plot dimensions and simplify simulation plot facets#204
daattali wants to merge 6 commits into
masterfrom
feat-simplify-plot-facets

Conversation

@daattali
Copy link
Copy Markdown
Collaborator

@daattali daattali commented Apr 22, 2026

This is an alternative solution to #203

In #203 , I added a slider that allows the user to choose the height of the Y axis. While doing that, I also optimized how empty space in the plot area is utilized. After doing that, I noticed that if I simply make the Y axis a little taller by default, the plots will always be legible and there's no need to let the user modify the height. In this PR, you'll be able to see that the plot looks good and legible whether you have one drug or 15 drugs. Also, now the text size doesn't get smaller just because you have more drugs - each drug plot looks identical regardless of how many drugs we're plotting.

There is one issue so far with this PR, but I wanted to show this to you @StevenLShafer to see if you even want this, or if you prefer #203 where the user can choose the height. The issue in this PR is that the plot in the powerpoint slide has messed up dimensions.

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request implements dynamic plot sizing by integrating a JavaScript ResizeObserver to track the plot container's width and communicate it to the Shiny server. The R backend has been updated to calculate plot height and aspect ratios dynamically based on this width, allowing for a more responsive UI. Additionally, several static global variables for plot formatting were removed in favor of simplified, fixed values. One critical issue was identified where the aspect ratio calculation in simulationPlot.R could fail or produce invalid results if the container width is too small, potentially leading to a division by zero or negative values.

Comment thread R/simulationPlot.R
@github-actions
Copy link
Copy Markdown

Preview Deployment

This PR has been deployed to: https://steveshafer.shinyapps.io/stanpumpr_PR_204/

This deployment will be automatically cleaned up when the PR is closed.

@github-actions
Copy link
Copy Markdown

Preview Deployment

This PR has been deployed to: https://steveshafer.shinyapps.io/stanpumpr_PR_204/

This deployment will be automatically cleaned up when the PR is closed.

@github-actions
Copy link
Copy Markdown

Preview Deployment

This PR has been deployed to: https://steveshafer.shinyapps.io/stanpumpr_PR_204/

This deployment will be automatically cleaned up when the PR is closed.

@github-actions
Copy link
Copy Markdown

Preview Deployment

This PR has been deployed to: https://steveshafer.shinyapps.io/stanpumpr_PR_204/

This deployment will be automatically cleaned up when the PR is closed.

@StevenLShafer
Copy link
Copy Markdown
Owner

I prefer 203, where the user has the option to adjust the plot height. However, the lower limit for plot height in the slider should correspond to the height in #204. I agree - it looks very nice. There is no reason to make the graphs thinner than in #204, now that it's possible to scroll the graphic. However, there are situations where it will be useful to make the graphs taller (thicker, whatever) than #204 default height, mostly to highlight small changes in concentration.

@StevenLShafer StevenLShafer reopened this Apr 23, 2026
@github-actions github-actions Bot removed the DEPLOY label Apr 23, 2026
@daattali daattali closed this Apr 24, 2026
@daattali daattali deleted the feat-simplify-plot-facets branch April 24, 2026 05:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants