Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
kmap
xsocs
Commits
6a69002a
Commit
6a69002a
authored
Nov 12, 2020
by
Thomas Vincent
Browse files
Update to match silx 0.14 and remove some deprecation warnings
parent
b420043b
Changes
1
Hide whitespace changes
Inline
Side-by-side
xsocs/gui/widgets/XsocsPlot2D.py
View file @
6a69002a
...
...
@@ -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
silx.io.utils
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"""
try
:
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.
,
name
=
'viridis'
)
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
(
'v
iridis
'
)),
(
'viridis'
,
_getV
iridis
(
)),
(
'gray'
,
cm
.
gray
)])
def
__init__
(
self
,
plot
,
curve
,
**
kwargs
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment