cobra icon indicating copy to clipboard operation
cobra copied to clipboard

Matplotlib styles bug fix

Open patrickleonardy opened this issue 1 year ago • 1 comments

Bug

The seaborn-ticks and seaborn-whitegrid matplotlib styles which were available in matplotlib 3.4.* are not available since matplotlib 3.6.*, and have been substituted with seaborn-v0_8-ticks and seaborn-v0_8-whitegrid respectively.

The problem is that cobra requirements.txt asks for matplotlib>=3.4.3, which can create the issue if the matplotlib version installed is actually greater than 3.5.* (last version supporting the seaborn-ticks plot style).

Task Description

You can check yourselves in the style files that are linked here below from the matplotlib GitHub repo:

v2.2.* and v3.5.* versus v3.6.* and v3.8.* (latest)

Regarding Cobra, the files where these styles are used are:

  • ./cobra/evaluation/plotting_utils.py
  • ./cobra/evaluation/pigs_tables.py
  • ./cobra/evaluation/evaluator.py

Solution:

Found where they mention the change in the Matplotlib changelog: https://matplotlib.org/stable/api/prev_api_changes/api_changes_3.6.0.html#seaborn-styles-renamed

matplotlib's team advise is to take the style directly from the seaborn package. Therefore, the solution for the long run should probably not be neither 2 nor 3, although I proposed them haha.

patrickleonardy avatar Oct 23 '23 10:10 patrickleonardy