X-DataInitiative / tick

Module for statistical learning, with a particular emphasis on time-dependent modelling
https://x-datainitiative.github.io/tick/
BSD 3-Clause "New" or "Revised" License
484 stars 105 forks source link

Matplotlib back-end overwritten #426

Open sumau opened 4 years ago

sumau commented 4 years ago

Importing tick overrides the matplotlib back-end:

>>> import matplotlib >>> matplotlib.get_backend() 'module://backend_interagg' >>> from tick.linear_model import LogisticRegression >>> matplotlib.get_backend() 'agg'

PhilipDeegan commented 4 years ago

we set agg if the environment variable "DISPLAY" is set to "-1"

https://github.com/X-DataInitiative/tick/blob/master/tick/base/__init__.py#L14

this is for testing without a GUI

sumau commented 4 years ago

Thanks for quick response! The first part of the condition evaluates to True when I use pycharm with Ubuntu WSL:

(os.name == 'posix' and 'DISPLAY' not in os.environ and not (sys.platform == 'darwin' and matplotlib.get_backend() == 'MacOSX')

Maybe you should remove it and leave the DISPLAY == -1 condition only? I have a work-around so no worries if that's not possible :-)

sumau commented 4 years ago

And happy to submit a pull-request if you agree