Skip to content

Commit

Permalink
Merge pull request #323 from wright-group/development
Browse files Browse the repository at this point in the history
2.13.9
  • Loading branch information
ksunden committed Oct 5, 2017
2 parents 7358d1d + ba4475d commit 88c84c1
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 17 deletions.
2 changes: 1 addition & 1 deletion VERSION
@@ -1 +1 @@
2.13.8
2.13.9
33 changes: 17 additions & 16 deletions WrightTools/artists.py
Expand Up @@ -68,12 +68,12 @@ def _parse_cmap(self, data=None, channel_index=None, **kwargs):
kwargs['cmap'] = colormaps['default']
return kwargs

def _apply_labels(self, label='none', xlabel=None, ylabel=None, data=None, channel_index=0):
def _apply_labels(self, autolabel='none', xlabel=None, ylabel=None, data=None, channel_index=0):
"""Apply x and y labels to axes.
Parameters
----------
label : {'none', 'both', 'x', 'y'} (optional)
autolabel : {'none', 'both', 'x', 'y'} (optional)
Label(s) to apply from data. Default is none.
xlabel : string (optional)
x label. Default is None.
Expand All @@ -85,9 +85,9 @@ def _apply_labels(self, label='none', xlabel=None, ylabel=None, data=None, chann
Channel index. Default is 0.
"""
# read from data
if label in ['xy', 'both', 'x'] and not xlabel:
if autolabel in ['xy', 'both', 'x'] and not xlabel:
xlabel = data.axes[0].label
if label in ['xy', 'both', 'y'] and not ylabel:
if autolabel in ['xy', 'both', 'y'] and not ylabel:
if data.dimensionality == 1:
ylabel = data.channels[channel_index].label
elif data.dimensionality == 2:
Expand Down Expand Up @@ -173,7 +173,7 @@ def contour(self, *args, **kwargs):
dynamic_range : boolean (optional)
Force plotting of all contours, overloading for major extent. Only applies to signed
data. Default is False.
label : {'none', 'both', 'x', 'y'} (optional)
autolabel : {'none', 'both', 'x', 'y'} (optional)
Parameterize application of labels directly from data object. Default is none.
xlabel : string (optional)
xlabel. Default is None.
Expand Down Expand Up @@ -224,9 +224,9 @@ def contour(self, *args, **kwargs):
if 'alpha' not in kwargs.keys():
kwargs['alpha'] = 0.5
# labels
self._apply_labels(label=kwargs.pop('label', False),
self._apply_labels(autolabel=kwargs.pop('autolabel', False),
xlabel=kwargs.pop('xlabel', None),
ylabel=kwargs.pop('xlabel', None),
ylabel=kwargs.pop('ylabel', None),
data=data, channel_index=channel_index)
# call parent
return matplotlib.axes.Axes.contour(self, *args, **kwargs) # why can't I use super?
Expand All @@ -243,7 +243,7 @@ def contourf(self, *args, **kwargs):
dynamic_range : boolean (optional)
Force plotting of all contours, overloading for major extent. Only applies to signed
data. Default is False.
label : {'none', 'both', 'x', 'y'} (optional)
autolabel : {'none', 'both', 'x', 'y'} (optional)
Parameterize application of labels directly from data object. Default is none.
xlabel : string (optional)
xlabel. Default is None.
Expand Down Expand Up @@ -286,9 +286,9 @@ def contourf(self, *args, **kwargs):
if 'levels' not in kwargs.keys():
kwargs['levels'] = np.linspace(kwargs.pop('vmin'), kwargs.pop('vmax'), 256)
# labels
self._apply_labels(label=kwargs.pop('label', False),
self._apply_labels(autolabel=kwargs.pop('autolabel', False),
xlabel=kwargs.pop('xlabel', None),
ylabel=kwargs.pop('xlabel', None),
ylabel=kwargs.pop('ylabel', None),
data=data, channel_index=channel_index)
# Overloading contourf in an attempt to fix aliasing problems when saving vector graphics
# see https://stackoverflow.com/questions/15822159
Expand Down Expand Up @@ -350,7 +350,7 @@ def pcolor(self, *args, **kwargs):
dynamic_range : boolean (optional)
Force plotting of all contours, overloading for major extent. Only applies to signed
data. Default is False.
label : {'none', 'both', 'x', 'y'} (optional)
autolabel : {'none', 'both', 'x', 'y'} (optional)
Parameterize application of labels directly from data object. Default is none.
xlabel : string (optional)
xlabel. Default is None.
Expand Down Expand Up @@ -391,9 +391,9 @@ def pcolor(self, *args, **kwargs):
kwargs = self._parse_limits(zi=args[2], **kwargs)
kwargs = self._parse_cmap(**kwargs)
# labels
self._apply_labels(label=kwargs.pop('label', False),
self._apply_labels(autolabel=kwargs.pop('autolabel', False),
xlabel=kwargs.pop('xlabel', None),
ylabel=kwargs.pop('xlabel', None),
ylabel=kwargs.pop('ylabel', None),
data=data, channel_index=channel_index)
# call parent
return matplotlib.axes.Axes.pcolor(self, *args, **kwargs) # why can't I use super?
Expand All @@ -410,7 +410,7 @@ def plot(self, *args, **kwargs):
dynamic_range : boolean (optional)
Force plotting of all contours, overloading for major extent. Only applies to signed
data. Default is False.
label : {'none', 'both', 'x', 'y'} (optional)
autolabel : {'none', 'both', 'x', 'y'} (optional)
Parameterize application of labels directly from data object. Default is none.
xlabel : string (optional)
xlabel. Default is None.
Expand Down Expand Up @@ -442,11 +442,12 @@ def plot(self, *args, **kwargs):
data = None
channel_index = 0
# labels
self._apply_labels(label=kwargs.pop('label', False),
self._apply_labels(autolabel=kwargs.pop('autolabel', False),
xlabel=kwargs.pop('xlabel', None),
ylabel=kwargs.pop('xlabel', None),
ylabel=kwargs.pop('ylabel', None),
data=data, channel_index=channel_index)
# call parent
print(kwargs)
return matplotlib.axes.Axes.plot(self, *args, **kwargs) # why can't I use super?

def plot_data(self, data, channel=0, interpolate=False, coloring=None,
Expand Down

0 comments on commit 88c84c1

Please sign in to comment.