Enhance plot dimensions and simplify simulation plot facets#204
Enhance plot dimensions and simplify simulation plot facets#204daattali wants to merge 6 commits into
Conversation
…f the available width and height; fixes #200
There was a problem hiding this comment.
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.
|
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. |
|
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. |
|
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. |
|
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. |
|
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. |
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.