Commit 6a69002a authored by Thomas Vincent's avatar Thomas Vincent
Browse files

Update to match silx 0.14 and remove some deprecation warnings

parent b420043b
......@@ -36,18 +36,17 @@ from collections import namedtuple, OrderedDict
import numpy as np
from matplotlib import cm
from matplotlib.colors import Normalize
from matplotlib.colors import Normalize, ListedColormap
from silx.gui import qt as Qt
from silx.gui import colors
from import savetxt
from silx.gui.icons import getQIcon
from silx.gui.plot import PlotWindow
from silx.math.histogram import Histogramnd
from silx.gui.widgets.RangeSlider import RangeSlider
from silx.gui.plot.matplotlib import Colormap
from ..widgets.Containers import GroupBox
from ..widgets.PointWidget import PointWidget
from ..widgets.Input import StyledLineEdit
......@@ -61,6 +60,16 @@ XsocsPlot2DColormap = namedtuple('XsocsPlot2DColormap',
['colormap', 'minVal', 'maxVal', 'nColors'])
def _getViridis():
"""Get viridis colormap"""
return cm.viridis
except AttributeError: # Fallback for matplotlib < 1.5.0 (i.e., debian 8)
return ListedColormap(
colors.Colormap('viridis').getNColors(256).astype(np.float32) / 255.,
def _arrayToPixmap(vector, cmap, nColors=256):
Creates a pixmap from an array, using the provided colormap.
......@@ -134,7 +143,7 @@ class XsocsPlot2DColorDialog(Qt.QDialog):
colormaps = OrderedDict([('jet', cm.jet),
('afmhot', cm.afmhot),
('viridis', Colormap.getColormap('viridis')),
('viridis', _getViridis()),
('gray', cm.gray)])
def __init__(self, plot, curve, **kwargs):
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment