Added plot style context managers to all plot methods#208
Open
Tom-Kingstone wants to merge 5 commits intodevelopfrom
Open
Added plot style context managers to all plot methods#208Tom-Kingstone wants to merge 5 commits intodevelopfrom
Tom-Kingstone wants to merge 5 commits intodevelopfrom
Conversation
…ot with matplotlib
6ab9999 to
c387559
Compare
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.
NOTE: Depends on
Issues addressed by this PR
Closes #204
This removes the need to globally set plot style in dependent packages (see this PR for example), and allows setting it dynamically on method call using the kwarg "style_context". By default all the plot methods will use "python_toolkit.bhom" as the plot style, but this can be overridden by passing "default" to instead use whatever default matplotlib has currently set.
Moved the mplstyle files to the root of the package just to allow easy selection in code (allows passing "python_toolkit.bhom" instead of the path to the .mplstyle file)
Also added a dark theme (much to the benefit of my eyes on dark backgrounds) called bhom_dark.
This only works for matplotlib based plots, so plotly plots (like parallel_coordinate_plot) do not allow this.
Test files
Run the unit tests and ensure they pass, see it in action by using any of the matplotlib based plot methods (eg. heatmap) and passing
style_context="python_toolkit.bhom"to the method.Changelog
style_contextkwarg for all matplotlib plot methodsAdditional comments
packages that depend on python_toolkit must change any references to the
python_toolkit/bhom/bhom.mplstylefile topython_toolkit/bhom.mplstyleor more cleanly with matplotlib, use"python_toolkit.bhom"