Skip to content

Change plot style functionality to be context based rather than global #204

@Tom-Kingstone

Description

@Tom-Kingstone

Description:

Currently, python_toolkit is (or should be, based on LadybugTools_Toolkit) set up to set the matplotlib style to the bhom.mplstyle. While this does work for setting the plot style for bhom plots, it is set globally and thus also affects modules that are not from bhom.

See https://matplotlib.org/stable/users/explain/customizing.html:
Likely will change to add the mplstyle to the package like is describes so it can be set using plt.style.use("bhom") or similar if a user wishes to set it globally, and then also use local context managers to set the plot style for methods. E.g.
heatmap.py

def heatmap(...):
    with plt.style.context('bhom'):
         #heatmap code here
    return ax

If a user wishes to use a different context for the heatmap, perhaps this could be added as a kwarg style_context which defaults to "bhom"

Metadata

Metadata

Assignees

Labels

type:featureNew capability or enhancement

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions