From ceef4301d8c7ac889825fb2d39c602611ab7328d Mon Sep 17 00:00:00 2001 From: Philipp Rudiger Date: Thu, 10 Dec 2015 17:45:13 +0000 Subject: [PATCH 01/16] Renamed matplotlib orientation parameter to invert_axes --- holoviews/plotting/bokeh/element.py | 4 +++- holoviews/plotting/mpl/chart.py | 22 ++++++---------------- holoviews/plotting/mpl/element.py | 17 ++++++++++------- holoviews/plotting/mpl/plot.py | 6 +++--- holoviews/plotting/mpl/raster.py | 2 +- 5 files changed, 23 insertions(+), 28 deletions(-) diff --git a/holoviews/plotting/bokeh/element.py b/holoviews/plotting/bokeh/element.py index 8e3272ba72..f5d9166657 100644 --- a/holoviews/plotting/bokeh/element.py +++ b/holoviews/plotting/bokeh/element.py @@ -58,6 +58,9 @@ class ElementPlot(BokehPlot, GenericElementPlot): {'ticks': '20pt', 'title': '15pt', 'ylabel': '5px', 'xlabel': '5px'}""") + invert_axes = param.Boolean(default=False, doc=""" + Whether to invert the x- and y-axis""") + invert_xaxis = param.Boolean(default=False, doc=""" Whether to invert the plot x-axis.""") @@ -139,7 +142,6 @@ class ElementPlot(BokehPlot, GenericElementPlot): def __init__(self, element, plot=None, invert_axes=False, show_labels=['x', 'y'], **params): - self.invert_axes = invert_axes self.show_labels = show_labels self.current_ranges = None super(ElementPlot, self).__init__(element, **params) diff --git a/holoviews/plotting/mpl/chart.py b/holoviews/plotting/mpl/chart.py index 2cd6547826..c9612727a5 100644 --- a/holoviews/plotting/mpl/chart.py +++ b/holoviews/plotting/mpl/chart.py @@ -291,7 +291,7 @@ def __init__(self, histograms, **params): super(HistogramPlot, self).__init__(histograms, **params) - if self.orientation == 'vertical': + if self.invert_axes: self.axis_settings = ['ylabel', 'xlabel', 'yticks'] else: self.axis_settings = ['xlabel', 'ylabel', 'xticks'] @@ -309,7 +309,7 @@ def initialize_plot(self, ranges=None): # Get plot ranges and values edges, hvals, widths, lims = self._process_hist(hist) - if self.orientation == 'vertical': + if self.invert_axes: self.offset_linefn = self.handles['axis'].axvline self.plotfn = self.handles['axis'].barh else: @@ -363,7 +363,7 @@ def _compute_ticks(self, element, edges, widths, lims): def get_extents(self, element, ranges): x0, y0, x1, y1 = super(HistogramPlot, self).get_extents(element, ranges) y0 = np.nanmin([0, y0]) - return (y0, x0, y1, x1) if self.orientation == 'vertical' else (x0, y0, x1, y1) + return (x0, y0, x1, y1) def _process_axsettings(self, hist, lims, ticks): @@ -390,7 +390,7 @@ def _update_artists(self, key, hist, edges, hvals, widths, lims, ranges): """ plot_vals = zip(self.handles['artist'], edges, hvals, widths) for bar, edge, height, width in plot_vals: - if self.orientation == 'vertical': + if self.invert_axes: bar.set_y(edge) bar.set_width(height) bar.set_height(width) @@ -446,16 +446,6 @@ def _process_hist(self, hist): return edges, hvals, widths, lims - def _process_axsettings(self, hist, lims, ticks): - axsettings = super(SideHistogramPlot, self)._process_axsettings(hist, lims, ticks) - label = 'ylabel' if self.orientation == 'vertical' else 'xlabel' - if not self.show_xlabel: - axsettings[label] = '' - else: - axsettings[label] = str(hist.kdims[0]) - return axsettings - - def _update_artists(self, n, element, edges, hvals, widths, lims, ranges): super(SideHistogramPlot, self)._update_artists(n, element, edges, hvals, widths, lims, ranges) self._update_plot(n, element, self.handles['artist'], lims, ranges) @@ -494,7 +484,7 @@ def _update_plot(self, key, element, bars, lims, ranges): def get_extents(self, element, ranges): x0, _, x1, _ = element.extents _, y1 = element.range(1) - return (0, x0, y1, x1) if self.orientation == 'vertical' else (x0, 0, x1, y1) + return (x0, 0, x1, y1) def _colorize_bars(self, cmap, bars, element, main_range, dim): @@ -521,7 +511,7 @@ def _update_separator(self, offset): offset_line.set_visible(False) else: offset_line.set_visible(True) - if self.orientation == 'vertical': + if self.invert_axes: offset_line.set_xdata(offset) else: offset_line.set_ydata(offset) diff --git a/holoviews/plotting/mpl/element.py b/holoviews/plotting/mpl/element.py index c5e87a26a9..9dfc455418 100644 --- a/holoviews/plotting/mpl/element.py +++ b/holoviews/plotting/mpl/element.py @@ -31,6 +31,11 @@ class ElementPlot(GenericElementPlot, MPLPlot): bgcolor = param.ClassSelector(class_=(str, tuple), default=None, doc=""" If set bgcolor overrides the background color of the axis.""") + invert_axes = param.ObjectSelector(default=False, doc=""" + Inverts the axes of the plot. Note that this parameter may not + always be respected by all plots but should be respected by + adjoined plots when appropriate.""") + invert_xaxis = param.Boolean(default=False, doc=""" Whether to invert the plot x-axis.""") @@ -46,13 +51,6 @@ class ElementPlot(GenericElementPlot, MPLPlot): logz = param.Boolean(default=False, doc=""" Whether to apply log scaling to the y-axis of the Chart.""") - orientation = param.ObjectSelector(default='horizontal', - objects=['horizontal', 'vertical'], doc=""" - The orientation of the plot. Note that this parameter may not - always be respected by all plots but should be respected by - adjoined plots when appropriate valid options are 'horizontal' - and 'vertical'.""") - show_legend = param.Boolean(default=False, doc=""" Whether to show legend for the plot.""") @@ -139,6 +137,9 @@ def _finalize_axis(self, key, title=None, ranges=None, xticks=None, yticks=None, if isinstance(sp.hmap, HoloMap)) if element is not None and not suppress: xlabel, ylabel, zlabel = self._axis_labels(element, subplots, xlabel, ylabel, zlabel) + if self.invert_axes: + xlabel, ylabel = ylabel, xlabel + self._finalize_limits(axis, element, subplots, ranges) # Tick formatting @@ -227,6 +228,8 @@ def _finalize_limits(self, axis, view, subplots, ranges): axis.set_zlim((zmin, zmax)) else: l, b, r, t = [coord if np.isreal(coord) else np.NaN for coord in extents] + if self.invert_axes: + l, b, r, t = b, l, t, r l, r = (c if np.isfinite(c) else None for c in (l, r)) if self.invert_xaxis or any(p.invert_xaxis for p in subplots): r, l = l, r diff --git a/holoviews/plotting/mpl/plot.py b/holoviews/plotting/mpl/plot.py index 974c88b2c9..9e4ea423d2 100644 --- a/holoviews/plotting/mpl/plot.py +++ b/holoviews/plotting/mpl/plot.py @@ -988,11 +988,11 @@ def _create_subplots(self, layout, positions, layout_dimensions, ranges, axes={} if not isinstance(view, GridSpace): override_opts = dict(aspect='square') elif pos == 'right': - right_opts = dict(orientation='vertical', - xaxis=None, yaxis='left') + right_opts = dict(invert_axes=True, + xaxis=None) override_opts = dict(subplot_opts, **right_opts) elif pos == 'top': - top_opts = dict(xaxis='bottom', yaxis=None) + top_opts = dict(yaxis=None) override_opts = dict(subplot_opts, **top_opts) # Override the plotopts as required diff --git a/holoviews/plotting/mpl/raster.py b/holoviews/plotting/mpl/raster.py index 4ba9c6da5d..abfeddf683 100644 --- a/holoviews/plotting/mpl/raster.py +++ b/holoviews/plotting/mpl/raster.py @@ -240,6 +240,7 @@ class RasterGridPlot(GridPlot, OverlayPlot): apply_ranges = param.Parameter(precedence=-1) apply_ticks = param.Parameter(precedence=-1) bgcolor = param.Parameter(precedence=-1) + invert_axes = param.Parameter(precedence=-1) invert_xaxis = param.Parameter(precedence=-1) invert_yaxis = param.Parameter(precedence=-1) legend_cols = param.Parameter(precedence=-1) @@ -247,7 +248,6 @@ class RasterGridPlot(GridPlot, OverlayPlot): logx = param.Parameter(precedence=-1) logy = param.Parameter(precedence=-1) logz = param.Parameter(precedence=-1) - orientation = param.Parameter(precedence=-1) show_grid = param.Parameter(precedence=-1) style_grouping = param.Parameter(precedence=-1) xticks = param.Parameter(precedence=-1) From 381ba64c97065b4523d7abc2f857314d02f86665 Mon Sep 17 00:00:00 2001 From: Philipp Rudiger Date: Thu, 10 Dec 2015 17:45:32 +0000 Subject: [PATCH 02/16] Avoid hardcoding PathPlot aspect option --- holoviews/plotting/mpl/path.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/holoviews/plotting/mpl/path.py b/holoviews/plotting/mpl/path.py index a59c686ad5..cf0cd25ae4 100644 --- a/holoviews/plotting/mpl/path.py +++ b/holoviews/plotting/mpl/path.py @@ -9,10 +9,13 @@ class PathPlot(ElementPlot): + aspect = param.Parameter(default='equal', doc=""" + PathPlots axes usually define single space so aspect of Paths + follows aspect in data coordinates by default.""") + style_opts = ['alpha', 'color', 'linestyle', 'linewidth', 'visible'] def __init__(self, *args, **params): - self.aspect = 'equal' super(PathPlot, self).__init__(*args, **params) def initialize_plot(self, ranges=None): From ac6bf2957a96c8a5496515338aa0d6a387891360 Mon Sep 17 00:00:00 2001 From: Philipp Rudiger Date: Thu, 10 Dec 2015 17:46:42 +0000 Subject: [PATCH 03/16] Added Spikes Element and plotting classes --- holoviews/element/chart.py | 20 ++++++ holoviews/plotting/bokeh/__init__.py | 7 +- holoviews/plotting/bokeh/chart.py | 50 +++++++++++++ holoviews/plotting/mpl/__init__.py | 4 +- holoviews/plotting/mpl/chart.py | 104 +++++++++++++++++++++++++++ 5 files changed, 181 insertions(+), 4 deletions(-) diff --git a/holoviews/element/chart.py b/holoviews/element/chart.py index f74902949b..5e5a01ab73 100644 --- a/holoviews/element/chart.py +++ b/holoviews/element/chart.py @@ -344,3 +344,23 @@ def __init__(self, data, **params): if isinstance(data, list) and all(isinstance(d, np.ndarray) for d in data): data = np.column_stack([d.flat if d.ndim > 1 else d for d in data]) super(VectorField, self).__init__(data, **params) + + + +class Spikes(Chart): + """ + Spikes is a 1D or 2D Element, which represents vertical or + horizontal ticks along some dimension. If an additional dimension + is supplied it will be used to specify the height of the + lines. The Element may therefore be used to represent 1D + distributions, spectrograms or spike trains in electrophysiology. + """ + + group = param.String(default='Spikes', constant=True) + + kdims = param.List(default=[Dimension('x')]) + + vdims = param.List(default=[]) + + _1d = True + diff --git a/holoviews/plotting/bokeh/__init__.py b/holoviews/plotting/bokeh/__init__.py index e0aa6eb758..c1978d4e16 100644 --- a/holoviews/plotting/bokeh/__init__.py +++ b/holoviews/plotting/bokeh/__init__.py @@ -3,7 +3,7 @@ from ...element import (Curve, Points, Scatter, Image, Raster, Path, RGB, Histogram, Spread, HeatMap, Contours, Path, Box, Bounds, Ellipse, Polygons, - ErrorBars, Text, HLine, VLine, Spline, + ErrorBars, Text, HLine, VLine, Spline, Spikes, Table, ItemTable, Surface, Scatter3D, Trisurface) from ...core.options import Options, Cycle, OptionTree from ...interface import DFrame @@ -14,7 +14,7 @@ from .callbacks import Callbacks from .element import OverlayPlot, BokehMPLWrapper, BokehMPLRawWrapper from .chart import (PointPlot, CurvePlot, SpreadPlot, ErrorPlot, HistogramPlot, - AdjointHistogramPlot) + AdjointHistogramPlot, SpikesPlot) from .path import PathPlot, PolygonPlot from .plot import GridPlot, LayoutPlot, AdjointLayoutPlot from .raster import RasterPlot, RGBPlot, HeatmapPlot @@ -37,6 +37,7 @@ Scatter: PointPlot, ErrorBars: ErrorPlot, Spread: SpreadPlot, + Spikes: SpikesPlot, # Rasters Image: RasterPlot, @@ -81,7 +82,7 @@ AdjointLayoutPlot.registry[Histogram] = AdjointHistogramPlot - +AdjointLayoutPlot.registry[Spikes] = Spikes try: from ..mpl.seaborn import TimeSeriesPlot, BivariatePlot, DistributionPlot diff --git a/holoviews/plotting/bokeh/chart.py b/holoviews/plotting/bokeh/chart.py index 2d22abf261..4d55bb3b55 100644 --- a/holoviews/plotting/bokeh/chart.py +++ b/holoviews/plotting/bokeh/chart.py @@ -203,3 +203,53 @@ def get_data(self, element, ranges=None): err_xs.append((x, x)) err_ys.append((y - neg, y + pos)) return (dict(xs=err_xs, ys=err_ys), self._mapping) + + +class SpikesPlot(PathPlot): + + color_index = param.Integer(default=1, doc=""" + Index of the dimension from which the color will the drawn""") + + spike_height = param.Number(default=0.1) + + yposition = param.Number(default=0.) + + style_opts = (['cmap', 'palette'] + line_properties) + + def get_extents(self, element, ranges): + l, b, r, t = super(SpikesPlot, self).get_extents(element, ranges) + if len(element.dimensions()) == 1: + b, t = self.yposition, self.yposition+self.spike_height + return l, b, r, t + + + def get_data(self, element, ranges=None): + style = self.style[self.cyclic_index] + dims = element.dimensions(label=True) + + ypos = self.yposition + if len(dims) > 1: + xs, ys = zip(*(((x, x), (ypos, ypos+y)) + for x, y in element.array())) + mapping = dict(xs=dims[0], ys=dims[1]) + keys = (dims[0], dims[1]) + else: + height = self.spike_height + xs, ys = zip(*(((x[0], x[0]), (ypos, ypos+height)) + for x in element.array())) + mapping = dict(xs=dims[0], ys='heights') + keys = (dims[0], 'heights') + if self.invert_axes: keys = keys[::-1] + data = dict(zip(keys, (xs, ys))) + + cmap = style.get('palette', style.get('cmap', None)) + if self.color_index < len(dims) and cmap: + cdim = dims[self.color_index] + map_key = 'color_' + cdim + mapping['color'] = map_key + cmap = get_cmap(cmap) + colors = element.dimension_values(cdim) + crange = ranges.get(cdim, None) + data[map_key] = map_colors(colors, crange, cmap) + + return data, mapping diff --git a/holoviews/plotting/mpl/__init__.py b/holoviews/plotting/mpl/__init__.py index 2e6c8ccf6d..1a1768f261 100644 --- a/holoviews/plotting/mpl/__init__.py +++ b/holoviews/plotting/mpl/__init__.py @@ -108,6 +108,7 @@ def grid_selector(grid): VectorField: VectorFieldPlot, ErrorBars: ErrorPlot, Spread: SpreadPlot, + Spikes: SpikesPlot, # General plots GridSpace: GridPlot, @@ -157,7 +158,8 @@ def grid_selector(grid): MPLPlot.sideplots.update({Histogram: SideHistogramPlot, - GridSpace: GridPlot}) + GridSpace: GridPlot, + Spikes: MarginalRugPlot}) options = Store.options(backend='matplotlib') diff --git a/holoviews/plotting/mpl/chart.py b/holoviews/plotting/mpl/chart.py index c9612727a5..4db6d40601 100644 --- a/holoviews/plotting/mpl/chart.py +++ b/holoviews/plotting/mpl/chart.py @@ -4,6 +4,7 @@ import numpy as np from matplotlib import cm from matplotlib import pyplot as plt +from matplotlib.collections import LineCollection import param @@ -12,6 +13,7 @@ from ...element import Points, Raster, Polygons from ..util import compute_sizes, get_sideplot_ranges from .element import ElementPlot, ColorbarPlot, LegendPlot +from .path import PathPlot class ChartPlot(ElementPlot): @@ -970,3 +972,105 @@ def update_handles(self, axis, element, key, ranges=None): bar[0].set_height(height) bar[0].set_y(prev) prev += height if np.isfinite(height) else 0 + + +class SpikesPlot(PathPlot): + + aspect = param.Parameter(default='square', doc=""" + The aspect ratio mode of the plot. Allows setting an + explicit aspect ratio as width/height as well as + 'square' and 'equal' options.""") + + color_index = param.Integer(default=1, doc=""" + Index of the dimension from which the color will the drawn""") + + spike_height = param.Number(default=0.5) + + yposition = param.Number(default=0) + + style_opts = PathPlot.style_opts + ['cmap'] + + def initialize_plot(self, ranges=None): + lines = self.hmap.last + key = self.keys[-1] + + ranges = self.compute_ranges(self.hmap, key, ranges) + ranges = match_spec(lines, ranges) + style = self.style[self.cyclic_index] + label = lines.label if self.show_legend else '' + + data, array, clim = self.get_data(lines, ranges) + if array is not None: + style['array'] = array + style['clim'] = clim + + line_segments = LineCollection(data, label=label, + zorder=self.zorder, **style) + self.handles['artist'] = line_segments + self.handles['axis'].add_collection(line_segments) + + return self._finalize_axis(key, ranges=ranges) + + + def get_data(self, element, ranges): + dimensions = element.dimensions(label=True) + ndims = len(dimensions) + + ypos = self.yposition + if ndims > 1: + data = [[(x, ypos), (x, ypos+y)] for x, y in element.array()] + else: + height = self.spike_height + data = [[(x[0], ypos), (x[0], ypos+height)] for x in element.array()] + + if self.invert_axes: + data = [(line[0][::-1], line[1][::-1]) for line in data] + + array, clim = None, None + if self.color_index < ndims: + cdim = dimensions[self.color_index] + array = element.dimension_values(cdim) + clime = ranges[cdim] + return data, array, clim + + + def update_handles(self, axis, element, key, ranges=None): + artist = self.handles['artist'] + data, array, clim = self.get_data(element) + artist.set_paths(data) + visible = self.style[self.cyclic_index].get('visible', True) + artist.set_visible(visible) + if array is not None: + paths.set_clim(ranges[val_dim]) + paths.set_array(cs) + + +class MarginalRugPlot(SpikesPlot): + + aspect = param.Parameter(default='auto', doc=""" + Aspect ratios on SideHistogramPlot should be determined by the + AdjointLayoutPlot.""") + + show_title = param.Boolean(default=False, doc=""" + Titles should be disabled on all SidePlots to avoid clutter.""") + + show_frame = param.Boolean(default=False) + + show_xlabel = param.Boolean(default=False, doc=""" + Whether to show the x-label of the plot. Disabled by default + because plots are often too cramped to fit the title correctly.""") + + xaxis = param.ObjectSelector(default='bare', + objects=['top', 'bottom', 'bare', 'top-bare', + 'bottom-bare', None], doc=""" + Whether and where to display the xaxis, bare options allow suppressing + all axis labels including ticks and xlabel. Valid options are 'top', + 'bottom', 'bare', 'top-bare' and 'bottom-bare'.""") + + yaxis = param.ObjectSelector(default='bare', + objects=['left', 'right', 'bare', 'left-bare', + 'right-bare', None], doc=""" + Whether and where to display the yaxis, bare options allow suppressing + all axis labels including ticks and ylabel. Valid options are 'left', + 'right', 'bare' 'left-bare' and 'right-bare'.""") + From 2d4105d0612a9d8db5b372e3ec88566e5384637d Mon Sep 17 00:00:00 2001 From: Philipp Rudiger Date: Thu, 10 Dec 2015 17:47:18 +0000 Subject: [PATCH 04/16] Added Spikes Element examples to Tutorial --- doc/Tutorials/Elements.ipynb | 90 ++++++++++++++++++++++++++++++++++++ 1 file changed, 90 insertions(+) diff --git a/doc/Tutorials/Elements.ipynb b/doc/Tutorials/Elements.ipynb index a6d17f0bd6..3a3965a95c 100644 --- a/doc/Tutorials/Elements.ipynb +++ b/doc/Tutorials/Elements.ipynb @@ -33,6 +33,7 @@ "
[``Scatter``](#Scatter)
Discontinuous collection of points indexed over a single dimension.
\n", "
[``Points``](#Points)
Discontinuous collection of points indexed over two dimensions.
\n", "
[``VectorField``](#VectorField)
Cyclic variable (and optional auxiliary data) distributed over two-dimensional space.
\n", + "
[``Spikes``](#Spikes)
A collection of horizontal or vertical lines at various locations with fixed height (1D) or variable height (2D).
\n", "
[``SideHistogram``](#SideHistogram)
Histogram binning data contained by some other ``Element``.
\n", " \n", "\n", @@ -461,6 +462,95 @@ "points + points[0.3:0.7, 0.3:0.7].hist()" ] }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### ``Spikes`` " + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Spikes represent any number of horizontal or vertical line segments with fixed or variable heights. There are a number of uses for this type, first of all they may be used as a rugplot to give an overview of a one-dimensional distribution. They may also be useful in more domain specific cases, such as visualizing spike trains for neurophysiology or spectrograms in physics and chemistry applications.\n", + "\n", + "In the simplest case a Spikes object therefore represents a 1D distribution:" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": false + }, + "outputs": [], + "source": [ + "%%opts Spikes [spike_height=0.1] (alpha=0.4)\n", + "xs = np.random.rand(50)\n", + "ys = np.random.rand(50)\n", + "hv.Points((xs, ys)) * hv.Spikes(xs)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "When supplying two dimensions to the Spikes object the second dimension will be mapped onto the line height. Optionally you may also supply a cmap and color_index to map color onto one of the dimensions. This way we can for example plot a mass spectrogram:" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": false + }, + "outputs": [], + "source": [ + "%%opts Spikes (cmap='Blues')\n", + "hv.Spikes(np.random.rand(20, 2), kdims=['Mass'], vdims=['Intensity'])" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Another possibility is to draw a number of spike trains as you would encounter in neuroscience:" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": false + }, + "outputs": [], + "source": [ + "%%opts Spikes [spike_height=0.1] NdOverlay [show_legend=False]\n", + "hv.NdOverlay({i: hv.Spikes(np.random.rand(10, 1))(plot=dict(yposition=0.1*i))\n", + " for i in range(10)})(plot=dict(yticks=[((i+1)*0.1-0.05, i)for i in range(10)]))" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Finally we may use ``Spikes`` to adjoin to a regular plot to visualize marginal distributions:" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": false + }, + "outputs": [], + "source": [ + "%%opts Spikes (alpha=0.4) [bgcolor='w'] AdjointLayout [border_size=0]\n", + "points = hv.Points(np.random.randn(100, 2))\n", + "points << hv.Spikes(points['y']) << hv.Spikes(points['x'])" + ] + }, { "cell_type": "markdown", "metadata": {}, From 45b542f7e865511026e539053ed4f9f169d1bb94 Mon Sep 17 00:00:00 2001 From: Philipp Rudiger Date: Thu, 10 Dec 2015 18:01:12 +0000 Subject: [PATCH 05/16] Minor fixes in bokeh plotting --- holoviews/plotting/bokeh/__init__.py | 2 +- holoviews/plotting/bokeh/element.py | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/holoviews/plotting/bokeh/__init__.py b/holoviews/plotting/bokeh/__init__.py index c1978d4e16..5a8cb47d1d 100644 --- a/holoviews/plotting/bokeh/__init__.py +++ b/holoviews/plotting/bokeh/__init__.py @@ -82,7 +82,7 @@ AdjointLayoutPlot.registry[Histogram] = AdjointHistogramPlot -AdjointLayoutPlot.registry[Spikes] = Spikes +AdjointLayoutPlot.registry[Spikes] = SpikesPlot try: from ..mpl.seaborn import TimeSeriesPlot, BivariatePlot, DistributionPlot diff --git a/holoviews/plotting/bokeh/element.py b/holoviews/plotting/bokeh/element.py index f5d9166657..48dd3b90b5 100644 --- a/holoviews/plotting/bokeh/element.py +++ b/holoviews/plotting/bokeh/element.py @@ -140,8 +140,7 @@ class ElementPlot(BokehPlot, GenericElementPlot): # instance attribute. _update_handles = ['source', 'glyph'] - def __init__(self, element, plot=None, invert_axes=False, - show_labels=['x', 'y'], **params): + def __init__(self, element, plot=None, show_labels=['x', 'y'], **params): self.show_labels = show_labels self.current_ranges = None super(ElementPlot, self).__init__(element, **params) From 8f38f3c350e6e293697f9372d9cf4003953a273f Mon Sep 17 00:00:00 2001 From: Philipp Rudiger Date: Fri, 11 Dec 2015 02:18:26 +0000 Subject: [PATCH 06/16] Renamed SpikesPlot plot options --- holoviews/plotting/bokeh/chart.py | 19 +++++++++++-------- holoviews/plotting/mpl/chart.py | 14 ++++++++------ 2 files changed, 19 insertions(+), 14 deletions(-) diff --git a/holoviews/plotting/bokeh/chart.py b/holoviews/plotting/bokeh/chart.py index 4d55bb3b55..5c5c634a62 100644 --- a/holoviews/plotting/bokeh/chart.py +++ b/holoviews/plotting/bokeh/chart.py @@ -210,16 +210,18 @@ class SpikesPlot(PathPlot): color_index = param.Integer(default=1, doc=""" Index of the dimension from which the color will the drawn""") - spike_height = param.Number(default=0.1) + spike_length = param.Number(default=0.5, doc=""" + The length of each spike if Spikes object is one dimensional.""") - yposition = param.Number(default=0.) + position = param.Number(default=0., doc=""" + The position of the lower end of each spike.""") - style_opts = (['cmap', 'palette'] + line_properties) + style_opts = (['color', 'cmap', 'palette'] + line_properties) def get_extents(self, element, ranges): l, b, r, t = super(SpikesPlot, self).get_extents(element, ranges) if len(element.dimensions()) == 1: - b, t = self.yposition, self.yposition+self.spike_height + b, t = self.position, self.position+self.spike_length return l, b, r, t @@ -227,18 +229,19 @@ def get_data(self, element, ranges=None): style = self.style[self.cyclic_index] dims = element.dimensions(label=True) - ypos = self.yposition + pos = self.position if len(dims) > 1: - xs, ys = zip(*(((x, x), (ypos, ypos+y)) + xs, ys = zip(*(((x, x), (pos, pos+y)) for x, y in element.array())) mapping = dict(xs=dims[0], ys=dims[1]) keys = (dims[0], dims[1]) else: - height = self.spike_height - xs, ys = zip(*(((x[0], x[0]), (ypos, ypos+height)) + height = self.spike_length + xs, ys = zip(*(((x[0], x[0]), (pos, pos+height)) for x in element.array())) mapping = dict(xs=dims[0], ys='heights') keys = (dims[0], 'heights') + if self.invert_axes: keys = keys[::-1] data = dict(zip(keys, (xs, ys))) diff --git a/holoviews/plotting/mpl/chart.py b/holoviews/plotting/mpl/chart.py index 4db6d40601..b6082029ee 100644 --- a/holoviews/plotting/mpl/chart.py +++ b/holoviews/plotting/mpl/chart.py @@ -984,9 +984,11 @@ class SpikesPlot(PathPlot): color_index = param.Integer(default=1, doc=""" Index of the dimension from which the color will the drawn""") - spike_height = param.Number(default=0.5) + spike_length = param.Number(default=0.5, doc=""" + The length of each spike if Spikes object is one dimensional.""") - yposition = param.Number(default=0) + position = param.Number(default=0., doc=""" + The position of the lower end of each spike.""") style_opts = PathPlot.style_opts + ['cmap'] @@ -1016,12 +1018,12 @@ def get_data(self, element, ranges): dimensions = element.dimensions(label=True) ndims = len(dimensions) - ypos = self.yposition + ypos = self.position if ndims > 1: - data = [[(x, ypos), (x, ypos+y)] for x, y in element.array()] + data = [[(x, pos), (x, pos+y)] for x, y in element.array()] else: - height = self.spike_height - data = [[(x[0], ypos), (x[0], ypos+height)] for x in element.array()] + height = self.spike_length + data = [[(x[0], pos), (x[0], pos+height)] for x in element.array()] if self.invert_axes: data = [(line[0][::-1], line[1][::-1]) for line in data] From 45f48196419d99649a89fa8af492c5aef84acc1f Mon Sep 17 00:00:00 2001 From: Philipp Rudiger Date: Fri, 11 Dec 2015 02:19:07 +0000 Subject: [PATCH 07/16] Improved default options for adjoined plots in bokeh --- holoviews/plotting/bokeh/chart.py | 12 +++++++++--- holoviews/plotting/bokeh/plot.py | 14 ++++++++------ 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/holoviews/plotting/bokeh/chart.py b/holoviews/plotting/bokeh/chart.py index 5c5c634a62..980741b686 100644 --- a/holoviews/plotting/bokeh/chart.py +++ b/holoviews/plotting/bokeh/chart.py @@ -4,7 +4,7 @@ from ...core import Dimension from ...core.util import max_range -from ...element import Chart, Raster, Points, Polygons +from ...element import Chart, Raster, Points, Polygons, Spikes from ..util import compute_sizes, get_sideplot_ranges from .element import ElementPlot, line_properties, fill_properties from .path import PathPlot, PolygonPlot @@ -147,13 +147,19 @@ class AdjointHistogramPlot(HistogramPlot): style_opts = HistogramPlot.style_opts + ['cmap'] - width = param.Integer(default=125) + height = param.Integer(default=125, doc="The height of the plot") + + width = param.Integer(default=125, doc="The width of the plot") + + show_title = param.Boolean(default=False, doc=""" + Whether to display the plot title.""") def get_data(self, element, ranges=None): if self.invert_axes: mapping = dict(top='left', bottom='right', left=0, right='top') else: mapping = dict(top='top', bottom=0, left='left', right='right') + data = dict(top=element.values, left=element.edges[:-1], right=element.edges[1:]) @@ -161,7 +167,7 @@ def get_data(self, element, ranges=None): main = self.adjoined.main range_item, main_range, dim = get_sideplot_ranges(self, element, main, ranges) vals = element.dimension_values(dim) - if isinstance(range_item, (Raster, Points, Polygons)): + if isinstance(range_item, (Raster, Points, Polygons, Spikes)): style = self.lookup_options(range_item, 'style')[self.cyclic_index] else: style = {} diff --git a/holoviews/plotting/bokeh/plot.py b/holoviews/plotting/bokeh/plot.py index dd04e3893b..fae3328145 100644 --- a/holoviews/plotting/bokeh/plot.py +++ b/holoviews/plotting/bokeh/plot.py @@ -353,13 +353,15 @@ def _create_subplots(self, layout, positions, layout_dimensions, ranges, num=0): if pos != 'main': plot_type = AdjointLayoutPlot.registry.get(vtype, plot_type) if pos == 'right': - side_opts = dict(height=main_plot.height, yaxis='right', - invert_axes=True, width=120, show_labels=['y'], - xticks=2, show_title=False) + yaxis = 'right-bare' if 'bare' in plot_type.yaxis else 'right' + side_opts = dict(height=main_plot.height, yaxis=yaxis, + width=plot_type.width, invert_axes=True, + show_labels=['y'], xticks=1, xaxis=main_plot.xaxis) else: - side_opts = dict(width=main_plot.width, xaxis='top', - height=120, show_labels=['x'], yticks=2, - show_title=False) + xaxis = 'top-bare' if 'bare' in plot_type.xaxis else 'top' + side_opts = dict(width=main_plot.width, xaxis=xaxis, + height=plot_type.height, show_labels=['x'], + yticks=1, yaxis=main_plot.yaxis) # Override the plotopts as required # Customize plotopts depending on position. From 588ae8a740a7dbf333fbbfee221e924ded0157c2 Mon Sep 17 00:00:00 2001 From: Philipp Rudiger Date: Fri, 11 Dec 2015 02:19:59 +0000 Subject: [PATCH 08/16] Added a MarginalSpikesPlot class for adjoined Spikes in bokeh --- holoviews/plotting/bokeh/__init__.py | 4 ++-- holoviews/plotting/bokeh/chart.py | 25 +++++++++++++++++++++++++ 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/holoviews/plotting/bokeh/__init__.py b/holoviews/plotting/bokeh/__init__.py index 5a8cb47d1d..600f43b220 100644 --- a/holoviews/plotting/bokeh/__init__.py +++ b/holoviews/plotting/bokeh/__init__.py @@ -14,7 +14,7 @@ from .callbacks import Callbacks from .element import OverlayPlot, BokehMPLWrapper, BokehMPLRawWrapper from .chart import (PointPlot, CurvePlot, SpreadPlot, ErrorPlot, HistogramPlot, - AdjointHistogramPlot, SpikesPlot) + AdjointHistogramPlot, SpikesPlot, MarginalSpikesPlot) from .path import PathPlot, PolygonPlot from .plot import GridPlot, LayoutPlot, AdjointLayoutPlot from .raster import RasterPlot, RGBPlot, HeatmapPlot @@ -82,7 +82,7 @@ AdjointLayoutPlot.registry[Histogram] = AdjointHistogramPlot -AdjointLayoutPlot.registry[Spikes] = SpikesPlot +AdjointLayoutPlot.registry[Spikes] = MarginalSpikesPlot try: from ..mpl.seaborn import TimeSeriesPlot, BivariatePlot, DistributionPlot diff --git a/holoviews/plotting/bokeh/chart.py b/holoviews/plotting/bokeh/chart.py index 980741b686..b2350b7f6c 100644 --- a/holoviews/plotting/bokeh/chart.py +++ b/holoviews/plotting/bokeh/chart.py @@ -262,3 +262,28 @@ def get_data(self, element, ranges=None): data[map_key] = map_colors(colors, crange, cmap) return data, mapping + + + +class MarginalSpikesPlot(SpikesPlot): + """ + SpikesPlot with useful defaults for plotting adjoined rug plot. + """ + + xaxis = param.ObjectSelector(default='top-bare', + objects=['top', 'bottom', 'bare', 'top-bare', + 'bottom-bare', None], doc=""" + Whether and where to display the xaxis, bare options allow suppressing + all axis labels including ticks and xlabel. Valid options are 'top', + 'bottom', 'bare', 'top-bare' and 'bottom-bare'.""") + + yaxis = param.ObjectSelector(default='right-bare', + objects=['left', 'right', 'bare', 'left-bare', + 'right-bare', None], doc=""" + Whether and where to display the yaxis, bare options allow suppressing + all axis labels including ticks and ylabel. Valid options are 'left', + 'right', 'bare' 'left-bare' and 'right-bare'.""") + + height = param.Integer(default=80, doc="Height of plot") + + width = param.Integer(default=80, doc="Width of plot") From 96daeb455b6005807ff92179f9b16955ad144da4 Mon Sep 17 00:00:00 2001 From: Philipp Rudiger Date: Fri, 11 Dec 2015 02:23:12 +0000 Subject: [PATCH 09/16] Fixed bug in mplt SpikesPlot --- holoviews/plotting/mpl/chart.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/holoviews/plotting/mpl/chart.py b/holoviews/plotting/mpl/chart.py index b6082029ee..3af3bdd4c2 100644 --- a/holoviews/plotting/mpl/chart.py +++ b/holoviews/plotting/mpl/chart.py @@ -1018,7 +1018,7 @@ def get_data(self, element, ranges): dimensions = element.dimensions(label=True) ndims = len(dimensions) - ypos = self.position + pos = self.position if ndims > 1: data = [[(x, pos), (x, pos+y)] for x, y in element.array()] else: From 4345ea13696311578797641dfb99f91c8abc835e Mon Sep 17 00:00:00 2001 From: Philipp Rudiger Date: Fri, 11 Dec 2015 02:41:10 +0000 Subject: [PATCH 10/16] Changed Spikes styling details --- holoviews/plotting/bokeh/__init__.py | 1 + holoviews/plotting/mpl/__init__.py | 1 + holoviews/plotting/mpl/chart.py | 5 ++++- 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/holoviews/plotting/bokeh/__init__.py b/holoviews/plotting/bokeh/__init__.py index 600f43b220..136e2e6ddb 100644 --- a/holoviews/plotting/bokeh/__init__.py +++ b/holoviews/plotting/bokeh/__init__.py @@ -115,6 +115,7 @@ options.Spread = Options('style', fill_color=Cycle(), fill_alpha=0.6, line_color='black') options.Histogram = Options('style', fill_color="#036564", line_color="#033649") options.Points = Options('style', color=Cycle()) +options.Spikes = Options('style', color='black') # Paths options.Contours = Options('style', color=Cycle()) diff --git a/holoviews/plotting/mpl/__init__.py b/holoviews/plotting/mpl/__init__.py index 1a1768f261..1fd5d3c228 100644 --- a/holoviews/plotting/mpl/__init__.py +++ b/holoviews/plotting/mpl/__init__.py @@ -177,6 +177,7 @@ def grid_selector(grid): options.Scatter3D = Options('style', facecolors=Cycle(), marker='o') options.Scatter3D = Options('plot', fig_size=150) options.Surface = Options('plot', fig_size=150) +options.Spikes = Options('style', color='black') # Rasters options.Image = Options('style', cmap='hot', interpolation='nearest') options.Raster = Options('style', cmap='hot', interpolation='nearest') diff --git a/holoviews/plotting/mpl/chart.py b/holoviews/plotting/mpl/chart.py index 3af3bdd4c2..bb3fc23d90 100644 --- a/holoviews/plotting/mpl/chart.py +++ b/holoviews/plotting/mpl/chart.py @@ -984,7 +984,7 @@ class SpikesPlot(PathPlot): color_index = param.Integer(default=1, doc=""" Index of the dimension from which the color will the drawn""") - spike_length = param.Number(default=0.5, doc=""" + spike_length = param.Number(default=0.1, doc=""" The length of each spike if Spikes object is one dimensional.""") position = param.Number(default=0., doc=""" @@ -1053,6 +1053,9 @@ class MarginalRugPlot(SpikesPlot): Aspect ratios on SideHistogramPlot should be determined by the AdjointLayoutPlot.""") + bgcolor = param.Parameter(default=(1, 1, 1, 0), doc=""" + Make plot background invisible.""") + show_title = param.Boolean(default=False, doc=""" Titles should be disabled on all SidePlots to avoid clutter.""") From 1c047bb5934a654f78062b77cd88da30722a95e5 Mon Sep 17 00:00:00 2001 From: Philipp Rudiger Date: Fri, 11 Dec 2015 02:52:48 +0000 Subject: [PATCH 11/16] Updated Spikes examples in notebooks --- doc/Tutorials/Elements.ipynb | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/doc/Tutorials/Elements.ipynb b/doc/Tutorials/Elements.ipynb index 3a3965a95c..66f14e9995 100644 --- a/doc/Tutorials/Elements.ipynb +++ b/doc/Tutorials/Elements.ipynb @@ -486,7 +486,7 @@ }, "outputs": [], "source": [ - "%%opts Spikes [spike_height=0.1] (alpha=0.4)\n", + "%%opts Spikes (alpha=0.4)\n", "xs = np.random.rand(50)\n", "ys = np.random.rand(50)\n", "hv.Points((xs, ys)) * hv.Spikes(xs)" @@ -507,7 +507,7 @@ }, "outputs": [], "source": [ - "%%opts Spikes (cmap='Blues')\n", + "%%opts Spikes (cmap='Reds')\n", "hv.Spikes(np.random.rand(20, 2), kdims=['Mass'], vdims=['Intensity'])" ] }, @@ -515,7 +515,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "Another possibility is to draw a number of spike trains as you would encounter in neuroscience:" + "Another possibility is to draw a number of spike trains as you would encounter in neuroscience. Here we generate 10 separate random spike trains and distribute them evenly across the space by setting their ``position``. By also declaring some yticks each spike traing can be labeled individually:" ] }, { @@ -526,16 +526,16 @@ }, "outputs": [], "source": [ - "%%opts Spikes [spike_height=0.1] NdOverlay [show_legend=False]\n", - "hv.NdOverlay({i: hv.Spikes(np.random.rand(10, 1))(plot=dict(yposition=0.1*i))\n", - " for i in range(10)})(plot=dict(yticks=[((i+1)*0.1-0.05, i)for i in range(10)]))" + "%%opts Spikes NdOverlay [show_legend=False]\n", + "hv.NdOverlay({i: hv.Spikes(np.random.randint(0, 100, 10), kdims=['Time'])(plot=dict(position=0.1*i))\n", + " for i in range(10)})(plot=dict(yticks=[((i+1)*0.1-0.05, i) for i in range(10)]))" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ - "Finally we may use ``Spikes`` to adjoin to a regular plot to visualize marginal distributions:" + "Finally we may use ``Spikes`` to visualize marginal distributions as adjoined plots:" ] }, { @@ -546,8 +546,8 @@ }, "outputs": [], "source": [ - "%%opts Spikes (alpha=0.4) [bgcolor='w'] AdjointLayout [border_size=0]\n", - "points = hv.Points(np.random.randn(100, 2))\n", + "%%opts Spikes (alpha=0.05) [spike_length=0.5] AdjointLayout [border_size=0]\n", + "points = hv.Points(np.random.randn(500, 2))\n", "points << hv.Spikes(points['y']) << hv.Spikes(points['x'])" ] }, From 9e3e44e28bcbb0f3026eaec225ebcc44e566644e Mon Sep 17 00:00:00 2001 From: philippjfr Date: Fri, 11 Dec 2015 14:30:41 +0000 Subject: [PATCH 12/16] Updated reference_data submodule reference --- doc/reference_data | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/reference_data b/doc/reference_data index 0391727272..860116e0fb 160000 --- a/doc/reference_data +++ b/doc/reference_data @@ -1 +1 @@ -Subproject commit 0391727272a64381496f8a62b591672c3fb8f2c1 +Subproject commit 860116e0fb8744d85a90d88d0a6ec5d35da814e1 From 6c7c9f5cea30b6eed6d1bf33ee1322366fe4b328 Mon Sep 17 00:00:00 2001 From: Philipp Rudiger Date: Fri, 11 Dec 2015 14:40:12 +0000 Subject: [PATCH 13/16] Added Spikes Element comparison --- holoviews/element/comparison.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/holoviews/element/comparison.py b/holoviews/element/comparison.py index 7bf3aaee0e..56c5046389 100644 --- a/holoviews/element/comparison.py +++ b/holoviews/element/comparison.py @@ -154,6 +154,7 @@ def register(cls): cls.equality_type_funcs[Trisurface] = cls.compare_trisurface cls.equality_type_funcs[Histogram] = cls.compare_histogram cls.equality_type_funcs[Bars] = cls.compare_bars + cls.equality_type_funcs[Spikes] = cls.compare_spikes # Tables cls.equality_type_funcs[ItemTable] = cls.compare_itemtables @@ -500,6 +501,10 @@ def compare_vectorfield(cls, el1, el2, msg='VectorField'): def compare_bars(cls, el1, el2, msg='Bars'): cls.compare_columns(el1, el2, msg) + @classmethod + def compare_spikes(cls, el1, el2, msg='Spikes'): + cls.compare_columns(el1, el2, msg) + #=========# # Rasters # #=========# From 527033ec583e907f5c275a30acf2bf49f3ab228c Mon Sep 17 00:00:00 2001 From: philippjfr Date: Fri, 11 Dec 2015 15:25:23 +0000 Subject: [PATCH 14/16] Updated reference_data submodule reference --- doc/reference_data | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/reference_data b/doc/reference_data index 860116e0fb..014c069ea2 160000 --- a/doc/reference_data +++ b/doc/reference_data @@ -1 +1 @@ -Subproject commit 860116e0fb8744d85a90d88d0a6ec5d35da814e1 +Subproject commit 014c069ea26ed90f289b0362577cdee2310b3618 From 95dbccd3a4e2e8e6442060f8bbb2ee5c633d1846 Mon Sep 17 00:00:00 2001 From: Philipp Rudiger Date: Fri, 11 Dec 2015 15:23:57 +0000 Subject: [PATCH 15/16] Updated Spikes docstring --- holoviews/element/chart.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/holoviews/element/chart.py b/holoviews/element/chart.py index 5e5a01ab73..82f66a10a5 100644 --- a/holoviews/element/chart.py +++ b/holoviews/element/chart.py @@ -349,11 +349,12 @@ def __init__(self, data, **params): class Spikes(Chart): """ - Spikes is a 1D or 2D Element, which represents vertical or - horizontal ticks along some dimension. If an additional dimension - is supplied it will be used to specify the height of the - lines. The Element may therefore be used to represent 1D - distributions, spectrograms or spike trains in electrophysiology. + Spikes is a 1D or 2D Element, which represents a series of + vertical or horizontal lines distributed along some dimension. If + an additional dimension is supplied it will be used to specify the + height of the lines. The Element may therefore be used to + represent 1D distributions, spectrograms or spike trains in + electrophysiology. """ group = param.String(default='Spikes', constant=True) From 7716fba118d75eade861d2120c017bcb9ccf4b0d Mon Sep 17 00:00:00 2001 From: Philipp Rudiger Date: Fri, 11 Dec 2015 16:03:32 +0000 Subject: [PATCH 16/16] Consistent naming for adjoined plots --- holoviews/plotting/bokeh/__init__.py | 6 +++--- holoviews/plotting/bokeh/chart.py | 4 ++-- holoviews/plotting/mpl/__init__.py | 2 +- holoviews/plotting/mpl/chart.py | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/holoviews/plotting/bokeh/__init__.py b/holoviews/plotting/bokeh/__init__.py index 136e2e6ddb..485294b374 100644 --- a/holoviews/plotting/bokeh/__init__.py +++ b/holoviews/plotting/bokeh/__init__.py @@ -14,7 +14,7 @@ from .callbacks import Callbacks from .element import OverlayPlot, BokehMPLWrapper, BokehMPLRawWrapper from .chart import (PointPlot, CurvePlot, SpreadPlot, ErrorPlot, HistogramPlot, - AdjointHistogramPlot, SpikesPlot, MarginalSpikesPlot) + SideHistogramPlot, SpikesPlot, SideSpikesPlot) from .path import PathPlot, PolygonPlot from .plot import GridPlot, LayoutPlot, AdjointLayoutPlot from .raster import RasterPlot, RGBPlot, HeatmapPlot @@ -81,8 +81,8 @@ 'bokeh') -AdjointLayoutPlot.registry[Histogram] = AdjointHistogramPlot -AdjointLayoutPlot.registry[Spikes] = MarginalSpikesPlot +AdjointLayoutPlot.registry[Histogram] = SideHistogramPlot +AdjointLayoutPlot.registry[Spikes] = SideSpikesPlot try: from ..mpl.seaborn import TimeSeriesPlot, BivariatePlot, DistributionPlot diff --git a/holoviews/plotting/bokeh/chart.py b/holoviews/plotting/bokeh/chart.py index b2350b7f6c..79f8ad16bf 100644 --- a/holoviews/plotting/bokeh/chart.py +++ b/holoviews/plotting/bokeh/chart.py @@ -143,7 +143,7 @@ def get_data(self, element, ranges=None): return (data, mapping) -class AdjointHistogramPlot(HistogramPlot): +class SideHistogramPlot(HistogramPlot): style_opts = HistogramPlot.style_opts + ['cmap'] @@ -265,7 +265,7 @@ def get_data(self, element, ranges=None): -class MarginalSpikesPlot(SpikesPlot): +class SideSpikesPlot(SpikesPlot): """ SpikesPlot with useful defaults for plotting adjoined rug plot. """ diff --git a/holoviews/plotting/mpl/__init__.py b/holoviews/plotting/mpl/__init__.py index 1fd5d3c228..e331ee7d56 100644 --- a/holoviews/plotting/mpl/__init__.py +++ b/holoviews/plotting/mpl/__init__.py @@ -159,7 +159,7 @@ def grid_selector(grid): MPLPlot.sideplots.update({Histogram: SideHistogramPlot, GridSpace: GridPlot, - Spikes: MarginalRugPlot}) + Spikes: SideSpikesPlot}) options = Store.options(backend='matplotlib') diff --git a/holoviews/plotting/mpl/chart.py b/holoviews/plotting/mpl/chart.py index bb3fc23d90..4858ef159a 100644 --- a/holoviews/plotting/mpl/chart.py +++ b/holoviews/plotting/mpl/chart.py @@ -1047,7 +1047,7 @@ def update_handles(self, axis, element, key, ranges=None): paths.set_array(cs) -class MarginalRugPlot(SpikesPlot): +class SideSpikesPlot(SpikesPlot): aspect = param.Parameter(default='auto', doc=""" Aspect ratios on SideHistogramPlot should be determined by the