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

Can one make render.plot and ui.output_plot non dynamic? #1443

Open
frere-jacques opened this issue Jun 3, 2024 · 0 comments
Open

Can one make render.plot and ui.output_plot non dynamic? #1443

frere-jacques opened this issue Jun 3, 2024 · 0 comments

Comments

@frere-jacques
Copy link

frere-jacques commented Jun 3, 2024

I have a library with a module that creates and plots matplotlib figures with multiple subplots.

The figsize is set dynamically based on the number and layout of the subplots. There are arrays plotted with imshow, overlayed with markers etc. The figsize, markersize etc. are all aligned to give a nice result.

If I plot this generated figures from terminal, from jupyter, from Pycharm, store it as png, whatsoever, it looks everywhere almost identical.

I want now to make use of that plots in a shiny app. But the format gets completely messed up. Spaces between subplots, labels, colorbars, ticks etc.

If I set the width and height both fixed in px like width="1200px", height='800px' it looks okay. But the next plot might be quadratic and would need width="800px", height='800px'.

Is there any way to extract the aspect ratio out of the returned figure (or maybe I can provide the aspect ratio myself) and use the aspect ration determined in the call to use that for the plot?

Edit: As a workaround I already stored the image to a file and then rendered that file. But I am afraid that this will cause conflicts between sessions or polution with files.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant