july icon indicating copy to clipboard operation
july copied to clipboard

make modifications of matplotlib configuration on a local level

Open camelCaseNick opened this issue 2 years ago • 1 comments

In order to not interfere with other potential components relying on matplotlib and implicitly expecting some or all configurations, namely rcParams, to have their respective default value, I would appreciate if changes to rcParams only influenced july.

Currently, it is reconfigured globally in https://github.com/e-hulten/july/blob/953ef3ee20549ca791d88d2f08e54862aa4c2f58/src/july/rcmod.py#L55

One possibility to achieve this would be for update_rcparams to use matplotlib.rc_context – returning a new independent context manager, to be used in https://github.com/e-hulten/july/blob/953ef3ee20549ca791d88d2f08e54862aa4c2f58/src/july/plot.py#L68

camelCaseNick avatar May 10 '22 16:05 camelCaseNick

Sorry for the late reply. Very good suggestion, I fully agree!

The next version of july will be using the

with plt.rc_context(rcmod): 
    ...

context manager to avoid interfering with other plots and packages.

e-hulten avatar Sep 21 '22 08:09 e-hulten