-
Notifications
You must be signed in to change notification settings - Fork 904
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
Recognize DARTS_CONFIGURE_MATPLOTLIB=0 #924
Conversation
* By default, darts still applies matplotlib configurations * If the environment variable DARTS_CONFIGURE_MATPLOTLIB=0 is set, then darts.u8plots_mplstyle is still defined but not applied
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this, LGTM.
I agree with your comment that opting-in using something along the lines of darts.apply_u8plots_mplstyle()
would be better eventually. Modifying the global config is not great. We could modify TimeSeries.plot()
in order to still apply some style in those plots only, maybe.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #924 +/- ##
=======================================
Coverage 91.70% 91.70%
=======================================
Files 74 74
Lines 7402 7404 +2
=======================================
+ Hits 6788 6790 +2
Misses 614 614 ☔ View full report in Codecov by Sentry. |
Thanks @hrzn! I just realized I did not add an entry to the change log. Should I push another commit with an entry under "Unreleased"? |
Yes that'd be great - thanks! |
Thank you @zgana, merging now, it will be part of the next release :) |
Fixes #892.
Summary
This PR makes it possible to import darts without changing the global matplotlib configuration.
Other Information
Normally it would be best to add tests of the new behavior, but it's difficult to test behavior in the root
__init__.py
. Both the pre-existing behavior and the adjustment here would be easier to test if the plotting configuration were factored out into some helper module. That would be a larger (though still fairly small) change.A larger question would be: should darts change the global matplotlib configuration by default? Making this opt-in would obviously cause an aesthetic mismatch for anyone following documentation produced prior to that change. But it would arguably be cleaner (and more testable) to require e.g.
darts.apply_u8plots_mplstyle()
or otherwise respect users' matplotlibrc.