Skip to content
Snippets Groups Projects
Commit 6ed2dc81 authored by Gigg, Martyn Anthony's avatar Gigg, Martyn Anthony
Browse files

Decay to Jet cmap if Viridis is not available

Older versions of matplotlib don't ship with Viridis...
parent c82a2330
No related branches found
No related tags found
No related merge requests found
...@@ -26,6 +26,10 @@ import math ...@@ -26,6 +26,10 @@ import math
from mantid.api import AnalysisDataService, MatrixWorkspace from mantid.api import AnalysisDataService, MatrixWorkspace
from mantid.kernel import Logger from mantid.kernel import Logger
import matplotlib.pyplot as plt import matplotlib.pyplot as plt
try:
from matplotlib.cm import viridis as DEFAULT_CMAP
except ImportError:
from matplotlib.cm import jet as DEFAULT_CMAP
from mantidqt.py3compat import is_text_string from mantidqt.py3compat import is_text_string
from mantidqt.dialogs.spectraselectordialog import get_spectra_selection from mantidqt.dialogs.spectraselectordialog import get_spectra_selection
from matplotlib.gridspec import GridSpec from matplotlib.gridspec import GridSpec
...@@ -38,7 +42,6 @@ from .figuretype import figure_type, FigureType ...@@ -38,7 +42,6 @@ from .figuretype import figure_type, FigureType
# Constants # Constants
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
PROJECTION = 'mantid' PROJECTION = 'mantid'
DEFAULT_COLORMAP = 'viridis'
# See https://matplotlib.org/api/_as_gen/matplotlib.figure.SubplotParams.html#matplotlib.figure.SubplotParams # See https://matplotlib.org/api/_as_gen/matplotlib.figure.SubplotParams.html#matplotlib.figure.SubplotParams
SUBPLOT_WSPACE = 0.5 SUBPLOT_WSPACE = 0.5
SUBPLOT_HSPACE = 0.5 SUBPLOT_HSPACE = 0.5
...@@ -217,7 +220,7 @@ def pcolormesh(workspaces, fig=None): ...@@ -217,7 +220,7 @@ def pcolormesh(workspaces, fig=None):
if subplot_idx < workspaces_len: if subplot_idx < workspaces_len:
ws = workspaces[subplot_idx] ws = workspaces[subplot_idx]
ax.set_title(ws.name()) ax.set_title(ws.name())
pcm = ax.pcolormesh(ws, cmap=DEFAULT_COLORMAP) pcm = ax.pcolormesh(ws, cmap=DEFAULT_CMAP)
for lbl in ax.get_xticklabels(): for lbl in ax.get_xticklabels():
lbl.set_rotation(45) lbl.set_rotation(45)
if col_idx < ncols - 1: if col_idx < ncols - 1:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment