-
Notifications
You must be signed in to change notification settings - Fork 117
Add width and height arguments to @render.plot
#783
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
Merged
Merged
Conversation
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
This isn't going to work because I forgot matplotlib shouldn't be loaded preemptively by us before user code has run. But I wanted to snapshot a working version before trying to fix that problem.
be3d618 to
bca5807
Compare
jcheng5
commented
Oct 25, 2023
wch
requested changes
Oct 25, 2023
wch
approved these changes
Oct 26, 2023
Collaborator
|
I just merged -- but note that we should have a changelog entry for this PR. |
jcheng5
added a commit
that referenced
this pull request
Oct 26, 2023
This fixes a bug introduced by #783, which was intended (in part) to allow render.plot code to set plot sizes by using matplotlib figure sizing. That code assumed that only explicit user code would cause the figure size to differ from matplotlib's default figure size (plt.rcParams["figure.figsize"]). But that's not true for seaborn, which likes to set its own sizes, which we then misidentified as being a high priority size directive that we should obey. https://seaborn.pydata.org/tutorial/function_overview.html#specifying-figure-sizes This change removes the logic that looks at whether the figure size changed. Instead, render.plot width/height can be set to 0 to cause the matplotlib figure size to be honored. However, we're not going to be emphasizing that in our docs, at least for now.
schloerke
added a commit
that referenced
this pull request
Nov 2, 2023
* main: (56 commits) Add actions step for nightly reporting -> Testrail (#774) Remove unused entry in manifest Bump version to 0.6.0.9000 Use latest htmltools Bump version to v0.6.0; Rearrange news to have API changes last Tweaks from testing Fix default width/height with implicit plot output (#792) Update deps (#794) Remove deprecated 'name' parameter from `Outputs` (#791) api(ui): Drop `toggle_` methods. Consolidate update accordion methods. Stronger typing for `layout_sidebar(sidebar)` and `page_sidebar(sidebar)` (#788) bug(sidebar): Revert sidebar icon back to chevron (#789) For `input_action_button`, default to having whitespace around button (#758) Remove output from template app (#775) Add output_args and suspend_display decorators (#786) Update value_box; Update to bootstrap 5.3; Update htmldeps (#772) tests: add sidebar test (#787) Seaborn plots should fill their output_plot (#785) Kwargs to uvicorn run (#780) Add width and height arguments to `@render.plot` (#783) gitgnore dist/ ...
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.
The primary goal of this PR is to provide an easy way to influence the width/height of the
output_plotthat's implicitly generated by displaying a@render.plot. There will also be a separate@output_argsdecorator that will let you set any argument on any implicit output, but the specific case of plot width/height seems like such a common case that it's worth the effort to make it dead simple.Two additional effects of this PR: the pixel dimensions of the image generated on the server side can now be influenced by
@render.plot(width=float, height=float), or if that is not specified, by using matplotlib/plotnine to set the Figure size (in inches). And it is now possible to set the DPI of a figure using matplotlib/plotnine, which changes the size of text.