Add figsize and rc_context parameters to tee decorator#11
Merged
Conversation
Sets figure size via set_size_inches after the plotter runs, so it works for both axes-level and figure-level plotting functions.
teeplot_rc_context wraps the plotter, postprocess, and save steps in a matplotlib.rc_context so rcParam overrides are scoped to the single tee call. Also documents the new teeplot_figsize kwarg in the README.
Avoids the mutable-default footgun by using an immutable mapping.
Avoids the mutable-default footgun by using an immutable mapping, consistent with teeplot_rc_context.
mmore500
commented
Apr 21, 2026
Owner
Author
mmore500
left a comment
There was a problem hiding this comment.
lgtm, ready to merge after CI
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
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.
Summary
This PR adds two new parameters to the
teedecorator to provide greater control over matplotlib figure properties and rendering context during plot generation.Key Changes
teeplot_figsizeparameter: Allows users to specify the figure size as a tuple of (width, height) in inches. When provided, the current figure is resized after the plotter runs.teeplot_rc_contextparameter: Accepts a mapping of matplotlib rcParams to apply viamatplotlib.rc_contextaround the plotter, postprocess, and save steps. This allows temporary modification of matplotlib settings without affecting the global state.teeplot_outattrsparameter type fromDict[str, str]toMapping[str, str]with aMappingProxyTypedefault for better immutability semantics.import typesto supportMappingProxyType.matplotlib.rc_contextto ensure rcParams are properly scoped.Implementation Details
teeplot_rc_contextparameter defaults to an emptyMappingProxyType({})to maintain backward compatibility while preventing accidental mutations.teeplot_figsizeoccurs after the plotter runs but before postprocessing, allowing postprocessing functions to work with the final figure dimensions.teeplot_figsize=Noneand default rc_context behavior.https://claude.ai/code/session_01VK9n4F4pX3Y9tsjR5DmUzr