tick icon indicating copy to clipboard operation
tick copied to clipboard

Matplotlib back-end overwritten

Open sumau opened this issue 4 years ago • 3 comments

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'

sumau avatar Mar 15 '20 13:03 sumau

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

PhilipDeegan avatar Mar 15 '20 13:03 PhilipDeegan

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 avatar Mar 15 '20 16:03 sumau

And happy to submit a pull-request if you agree

sumau avatar Mar 15 '20 16:03 sumau