summaryrefslogtreecommitdiff
path: root/silx/sx/_plot.py
diff options
context:
space:
mode:
authorPicca Frédéric-Emmanuel <picca@debian.org>2017-10-07 07:59:01 +0200
committerPicca Frédéric-Emmanuel <picca@debian.org>2017-10-07 07:59:01 +0200
commitbfa4dba15485b4192f8bbe13345e9658c97ecf76 (patch)
treefb9c6e5860881fbde902f7cbdbd41dc4a3a9fb5d /silx/sx/_plot.py
parentf7bdc2acff3c13a6d632c28c4569690ab106eed7 (diff)
New upstream version 0.6.0+dfsg
Diffstat (limited to 'silx/sx/_plot.py')
-rw-r--r--silx/sx/_plot.py27
1 files changed, 12 insertions, 15 deletions
diff --git a/silx/sx/_plot.py b/silx/sx/_plot.py
index e672b1a..e81e57e 100644
--- a/silx/sx/_plot.py
+++ b/silx/sx/_plot.py
@@ -27,7 +27,7 @@
__authors__ = ["T. Vincent"]
__license__ = "MIT"
-__date__ = "26/04/2017"
+__date__ = "27/06/2017"
import logging
@@ -35,6 +35,7 @@ import numpy
from ..gui.plot import Plot1D, Plot2D
from ..gui.plot.Colors import COLORDICT
+from ..gui.plot.Colormap import Colormap
from silx.third_party import six
@@ -114,9 +115,9 @@ def plot(*args, **kwargs):
if 'title' in kwargs:
plt.setGraphTitle(kwargs['title'])
if 'xlabel' in kwargs:
- plt.setGraphXLabel(kwargs['xlabel'])
+ plt.getXAxis().setLabel(kwargs['xlabel'])
if 'ylabel' in kwargs:
- plt.setGraphYLabel(kwargs['ylabel'])
+ plt.getYAxis().setLabel(kwargs['ylabel'])
color = kwargs.get('color')
linestyle = kwargs.get('linestyle')
@@ -196,7 +197,7 @@ def plot(*args, **kwargs):
return plt
-def imshow(data=None, cmap=None, norm='linear',
+def imshow(data=None, cmap=None, norm=Colormap.LINEAR,
vmin=None, vmax=None,
aspect=False,
origin=(0., 0.), scale=(1., 1.),
@@ -235,21 +236,17 @@ def imshow(data=None, cmap=None, norm='linear',
"""
plt = Plot2D()
plt.setGraphTitle(title)
- plt.setGraphXLabel(xlabel)
- plt.setGraphYLabel(ylabel)
+ plt.getXAxis().setLabel(xlabel)
+ plt.getYAxis().setLabel(ylabel)
# Update default colormap with input parameters
colormap = plt.getDefaultColormap()
if cmap is not None:
- colormap['name'] = cmap
- assert norm in ('linear', 'log')
- colormap['normalization'] = norm
- if vmin is not None:
- colormap['vmin'] = vmin
- if vmax is not None:
- colormap['vmax'] = vmax
- if vmin is not None and vmax is not None:
- colormap['autoscale'] = False
+ colormap.setName(cmap)
+ assert norm in Colormap.NORMALIZATIONS
+ colormap.setNormalization(norm)
+ colormap.setVMin(vmin)
+ colormap.setVMax(vmax)
plt.setDefaultColormap(colormap)
# Handle aspect