Skip to content
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

Scatter plot sizes #68

Open
wants to merge 7 commits into
base: dev-202403
Choose a base branch
from
Open

Scatter plot sizes #68

wants to merge 7 commits into from

Conversation

russHyde
Copy link
Collaborator

This sets the aspect ratio for scatter plots to be different from that for the dendrogram&heatmap images.
Previously the scatterplots would expand below the bottom of the browser window, despite having no need to be so large.

@russHyde
Copy link
Collaborator Author

After the changes:

Dendrogram aspect ratio is unaltered

image

But scatter plot aspect ratio is more squat

image

Previously:

Scatter plot aspect ratio was much more slim, and the figures took up all of the 1800px height available in the component where they were placed. This meant that a lot of the information in the scatter plot was off-page when a user viewed the image.

image

@russHyde russHyde requested a review from timbrock March 14, 2024 11:47
@russHyde russHyde force-pushed the scatter-plot-sizes branch 3 times, most recently from 9b3ae07 to 936e2f5 Compare March 21, 2024 10:52
@russHyde
Copy link
Collaborator Author

russHyde commented May 2, 2024

I'm having some problems getting the figures to fit in their containers in the Imperial app @timbrock .

The figures are generated using

  • ggiraph::girafe(..., width_svg = <width>, height_svg = <height>) ,
  • ggiraph::renderGirafe()
  • and UI-side ggiraph::girafeOutput()

The girafe() width/height values are specified "in inches. [...]. This will define the aspect ratio of the graphic as it will be used to define viewbox attribute of the SVG result."

The girafeOutput() has width and height parameters, the defaults are width = "100%", height = "500px".

According to the docs "When a girafe graphic is in a Shiny application, graphic will be resized according to the arguments width and height of the function girafeOutput. ..."

The trouble I have here is that the aspect ratios aren't guaranteed. If a dendrogram contains loads of nodes it will be tall-and-slim, if it only contains a few it will be squat. Scatter plots, which are also presented in the same place are of fixed aspect ratio.
There's another problem - with width = "100%" in the girafeOutput(), and with the guarantee about the resizing in the girafeOutput docs, we can still end up with a figure that splays over the right-hand edge of the wellPanel that they are embedded in.

@timbrock
Copy link
Collaborator

timbrock commented May 2, 2024

Might this be useful?

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