From ae8e9418e1939b8cf5c02ba818a2f0a0e41e71f2 Mon Sep 17 00:00:00 2001 From: Jean-Luc Stevens Date: Wed, 20 Dec 2017 13:16:06 +0000 Subject: [PATCH] Trisurface renamed to TriSurface (#2219) --- doc/Tutorials/Bokeh_Elements.ipynb | 12 +++++------ doc/Tutorials/Columnar_Data.ipynb | 2 +- doc/Tutorials/Elements.ipynb | 12 +++++------ .../demos/matplotlib/trisurf3d_demo.ipynb | 2 +- .../gallery/demos/plotly/trisurf3d_demo.ipynb | 2 +- .../{Trisurface.ipynb => TriSurface.ipynb} | 16 +++++++-------- .../{Trisurface.ipynb => TriSurface.ipynb} | 16 +++++++-------- examples/topics/simulation/sri_model.ipynb | 2 +- examples/user_guide/07-Tabular_Datasets.ipynb | 2 +- holoviews/element/__init__.py | 2 +- holoviews/element/chart3d.py | 20 +++++++++++++++---- holoviews/element/comparison.py | 3 ++- holoviews/plotting/mpl/__init__.py | 3 ++- holoviews/plotting/mpl/chart3d.py | 4 ++-- holoviews/plotting/plotly/__init__.py | 5 +++-- holoviews/plotting/plotly/chart3d.py | 4 ++-- 16 files changed, 61 insertions(+), 46 deletions(-) rename examples/reference/elements/matplotlib/{Trisurface.ipynb => TriSurface.ipynb} (81%) rename examples/reference/elements/plotly/{Trisurface.ipynb => TriSurface.ipynb} (80%) diff --git a/doc/Tutorials/Bokeh_Elements.ipynb b/doc/Tutorials/Bokeh_Elements.ipynb index 7a41a6b0a5..e17b3d1f55 100644 --- a/doc/Tutorials/Bokeh_Elements.ipynb +++ b/doc/Tutorials/Bokeh_Elements.ipynb @@ -48,7 +48,7 @@ "
\n", "
Surface
Continuous collection of points in a three-dimensional space.
\n", "
Scatter3D
Discontinuous collection of points in a three-dimensional space.
\n", - "
Trisurface
Continuous but irregular collection of points interpolated into a Surface using Delaunay triangulation.
\n", + "
TriSurface
Continuous but irregular collection of points interpolated into a Surface using Delaunay triangulation.
\n", "
\n", "\n", "\n", @@ -763,14 +763,14 @@ "``Scatter3D`` is the equivalent of ``Scatter`` but for two key dimensions, rather than just one.\n", "\n", "\n", - "### ``Trisurface`` " + "### ``TriSurface`` " ] }, { "cell_type": "markdown", "metadata": {}, "source": [ - "The ``Trisurface`` Element renders any collection of 3D points as a Surface by applying Delaunay triangulation. It thus supports arbitrary, non-gridded data, but it does not support indexing to find data values, since finding the closest ones would require a search." + "The ``TriSurface`` Element renders any collection of 3D points as a Surface by applying Delaunay triangulation. It thus supports arbitrary, non-gridded data, but it does not support indexing to find data values, since finding the closest ones would require a search." ] }, { @@ -779,8 +779,8 @@ "metadata": {}, "outputs": [], "source": [ - "%%opts Trisurface [fig_size=200] (cmap='hot_r')\n", - "hv.Trisurface((x.flat,y.flat,heights.flat))" + "%%opts TriSurface [fig_size=200] (cmap='hot_r')\n", + "hv.TriSurface((x.flat,y.flat,heights.flat))" ] }, { @@ -1418,5 +1418,5 @@ } }, "nbformat": 4, - "nbformat_minor": 0 + "nbformat_minor": 1 } diff --git a/doc/Tutorials/Columnar_Data.ipynb b/doc/Tutorials/Columnar_Data.ipynb index 548ced5c0f..e94ffce45b 100644 --- a/doc/Tutorials/Columnar_Data.ipynb +++ b/doc/Tutorials/Columnar_Data.ipynb @@ -80,7 +80,7 @@ "* 0D: BoxWhisker, Spikes, Distribution*, \n", "* 1D: Scatter, Curve, ErrorBars, Spread, Bars, BoxWhisker, Regression*\n", "* 2D: Points, HeatMap, Bars, BoxWhisker, Bivariate*\n", - "* 3D: Scatter3D, Trisurface, VectorField, BoxWhisker, Bars\n", + "* 3D: Scatter3D, TriSurface, VectorField, BoxWhisker, Bars\n", "\n", "\\* - requires Seaborn\n", "\n", diff --git a/doc/Tutorials/Elements.ipynb b/doc/Tutorials/Elements.ipynb index 08e5f76243..e21c23f218 100644 --- a/doc/Tutorials/Elements.ipynb +++ b/doc/Tutorials/Elements.ipynb @@ -44,7 +44,7 @@ "
\n", "
Surface
Continuous collection of points in a three-dimensional space.
\n", "
Scatter3D
Discontinuous collection of points in a three-dimensional space.
\n", - "
Trisurface
Continuous but irregular collection of points interpolated into a Surface using Delaunay triangulation.
\n", + "
TriSurface
Continuous but irregular collection of points interpolated into a Surface using Delaunay triangulation.
\n", "
\n", "\n", "\n", @@ -796,14 +796,14 @@ "``Scatter3D`` is the equivalent of ``Scatter`` but for two key dimensions, rather than just one.\n", "\n", "\n", - "### ``Trisurface`` " + "### ``TriSurface`` " ] }, { "cell_type": "markdown", "metadata": {}, "source": [ - "The ``Trisurface`` Element renders any collection of 3D points as a Surface by applying Delaunay triangulation. It thus supports arbitrary, non-gridded data, but it does not support indexing to find data values, since finding the closest ones would require a search." + "The ``TriSurface`` Element renders any collection of 3D points as a Surface by applying Delaunay triangulation. It thus supports arbitrary, non-gridded data, but it does not support indexing to find data values, since finding the closest ones would require a search." ] }, { @@ -812,8 +812,8 @@ "metadata": {}, "outputs": [], "source": [ - "%%opts Trisurface [fig_size=200] (cmap='hot_r')\n", - "hv.Trisurface((x.flat,y.flat,heights.flat))" + "%%opts TriSurface [fig_size=200] (cmap='hot_r')\n", + "hv.TriSurface((x.flat,y.flat,heights.flat))" ] }, { @@ -1454,5 +1454,5 @@ } }, "nbformat": 4, - "nbformat_minor": 0 + "nbformat_minor": 1 } diff --git a/examples/gallery/demos/matplotlib/trisurf3d_demo.ipynb b/examples/gallery/demos/matplotlib/trisurf3d_demo.ipynb index 9406c371f9..3a6dd7ae02 100644 --- a/examples/gallery/demos/matplotlib/trisurf3d_demo.ipynb +++ b/examples/gallery/demos/matplotlib/trisurf3d_demo.ipynb @@ -62,7 +62,7 @@ "# Compute z to make the pringle surface.\n", "z = np.sin(-x*y)\n", "\n", - "trisurface = hv.Trisurface((x, y, z))" + "trisurface = hv.TriSurface((x, y, z))" ] }, { diff --git a/examples/gallery/demos/plotly/trisurf3d_demo.ipynb b/examples/gallery/demos/plotly/trisurf3d_demo.ipynb index 45d013a6e1..d822571b50 100644 --- a/examples/gallery/demos/plotly/trisurf3d_demo.ipynb +++ b/examples/gallery/demos/plotly/trisurf3d_demo.ipynb @@ -63,7 +63,7 @@ "# Compute z to make the pringle surface.\n", "z = np.sin(-x*y)\n", "\n", - "trisurface = hv.Trisurface((x, y, z))" + "trisurface = hv.TriSurface((x, y, z))" ] }, { diff --git a/examples/reference/elements/matplotlib/Trisurface.ipynb b/examples/reference/elements/matplotlib/TriSurface.ipynb similarity index 81% rename from examples/reference/elements/matplotlib/Trisurface.ipynb rename to examples/reference/elements/matplotlib/TriSurface.ipynb index 546c0010ff..67f775b6c1 100644 --- a/examples/reference/elements/matplotlib/Trisurface.ipynb +++ b/examples/reference/elements/matplotlib/TriSurface.ipynb @@ -6,9 +6,9 @@ "source": [ "
\n", "
\n", - "
Title
Trisurface Element
\n", + "
Title
TriSurface Element
\n", "
Dependencies
Matplotlib
\n", - "
Backends
Matplotlib
\n", + "
Backends
Matplotlib
\n", "\n", "
\n", "
" @@ -29,7 +29,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "The ``Trisurface`` Element renders any collection of 3D points as a surface by applying [Delaunay triangulation](https://en.wikipedia.org/wiki/Delaunay_triangulation). It is therefore useful for plotting an arbitrary collection of datapoints as a 3D surface. Like other 3D elements it supports ``azimuth``, ``elevation`` and ``distance`` plot options to control the camera position:" + "The ``TriSurface`` Element renders any collection of 3D points as a surface by applying [Delaunay triangulation](https://en.wikipedia.org/wiki/Delaunay_triangulation). It is therefore useful for plotting an arbitrary collection of datapoints as a 3D surface. Like other 3D elements it supports ``azimuth``, ``elevation`` and ``distance`` plot options to control the camera position:" ] }, { @@ -38,10 +38,10 @@ "metadata": {}, "outputs": [], "source": [ - "%%opts Trisurface [azimuth=30 elevation=30 fig_size=200]\n", + "%%opts TriSurface [azimuth=30 elevation=30 fig_size=200]\n", "y,x = np.mgrid[-5:5, -5:5] * 0.1\n", "heights = np.sin(x**2+y**2)\n", - "hv.Trisurface((x.flat,y.flat,heights.flat))" + "hv.TriSurface((x.flat,y.flat,heights.flat))" ] }, { @@ -57,7 +57,7 @@ "metadata": {}, "outputs": [], "source": [ - "%%opts Trisurface [fig_size=200 colorbar=True] (cmap='fire')\n", + "%%opts TriSurface [fig_size=200 colorbar=True] (cmap='fire')\n", "\n", "u=np.linspace(0,2*np.pi, 24)\n", "v=np.linspace(-1,1, 8)\n", @@ -71,7 +71,7 @@ "y=tp*np.sin(u)\n", "z=0.5*v*np.sin(u/2.)\n", "\n", - "surface = hv.Trisurface((x, y, z), label='Moebius band')\n", + "surface = hv.TriSurface((x, y, z), label='Moebius band')\n", "surface" ] }, @@ -79,7 +79,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "For full documentation and the available style and plot options, use ``hv.help(hv.Trisurface).``" + "For full documentation and the available style and plot options, use ``hv.help(hv.TriSurface).``" ] } ], diff --git a/examples/reference/elements/plotly/Trisurface.ipynb b/examples/reference/elements/plotly/TriSurface.ipynb similarity index 80% rename from examples/reference/elements/plotly/Trisurface.ipynb rename to examples/reference/elements/plotly/TriSurface.ipynb index 58de5e1664..6e3922e147 100644 --- a/examples/reference/elements/plotly/Trisurface.ipynb +++ b/examples/reference/elements/plotly/TriSurface.ipynb @@ -6,9 +6,9 @@ "source": [ "
\n", "
\n", - "
Title
Trisurface Element
\n", + "
Title
TriSurface Element
\n", "
Dependencies
Matplotlib
\n", - "
Backends
Matplotlib
Plotly
\n", + "
Backends
Matplotlib
Plotly
\n", "
\n", "
" ] @@ -28,7 +28,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "The ``Trisurface`` Element renders any collection of 3D points as a surface by applying [Delaunay triangulation](https://en.wikipedia.org/wiki/Delaunay_triangulation). It is therefore useful for plotting an arbitrary collection of datapoints as a 3D surface. Like other 3D elements it supports ``azimuth``, ``elevation`` and ``distance`` plot options to control the camera position:" + "The ``TriSurface`` Element renders any collection of 3D points as a surface by applying [Delaunay triangulation](https://en.wikipedia.org/wiki/Delaunay_triangulation). It is therefore useful for plotting an arbitrary collection of datapoints as a 3D surface. Like other 3D elements it supports ``azimuth``, ``elevation`` and ``distance`` plot options to control the camera position:" ] }, { @@ -37,10 +37,10 @@ "metadata": {}, "outputs": [], "source": [ - "%%opts Trisurface [width=500 height=500]\n", + "%%opts TriSurface [width=500 height=500]\n", "y,x = np.mgrid[-5:5, -5:5] * 0.1\n", "heights = np.sin(x**2+y**2)\n", - "hv.Trisurface((x.flat,y.flat,heights.flat))" + "hv.TriSurface((x.flat,y.flat,heights.flat))" ] }, { @@ -56,7 +56,7 @@ "metadata": {}, "outputs": [], "source": [ - "%%opts Trisurface [width=500 height=500 colorbar=True] (cmap='fire')\n", + "%%opts TriSurface [width=500 height=500 colorbar=True] (cmap='fire')\n", "\n", "u=np.linspace(0,2*np.pi, 24)\n", "v=np.linspace(-1,1, 8)\n", @@ -70,7 +70,7 @@ "y=tp*np.sin(u)\n", "z=0.5*v*np.sin(u/2.)\n", "\n", - "surface = hv.Trisurface((x, y, z), label='Moebius band')\n", + "surface = hv.TriSurface((x, y, z), label='Moebius band')\n", "surface" ] }, @@ -78,7 +78,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "For full documentation and the available style and plot options, use ``hv.help(hv.Trisurface).``" + "For full documentation and the available style and plot options, use ``hv.help(hv.TriSurface).``" ] } ], diff --git a/examples/topics/simulation/sri_model.ipynb b/examples/topics/simulation/sri_model.ipynb index 69d2e1d4ef..5d126f68ec 100755 --- a/examples/topics/simulation/sri_model.ipynb +++ b/examples/topics/simulation/sri_model.ipynb @@ -576,7 +576,7 @@ "outputs": [], "source": [ "%%opts Layout [fig_size=200] \n", - "%%opts Trisurface (cmap='Reds_r' linewidth=0.1)\n", + "%%opts TriSurface (cmap='Reds_r' linewidth=0.1)\n", "(hv.Table(df).to.trisurface(['pVaccinated', 'Connections'],\n", " '$R_0$', [], group='$R_0$') +\n", "hv.Table(df).to.trisurface(['pVaccinated', 'Connections'],\n", diff --git a/examples/user_guide/07-Tabular_Datasets.ipynb b/examples/user_guide/07-Tabular_Datasets.ipynb index ba2ce65fba..7ca3a10903 100644 --- a/examples/user_guide/07-Tabular_Datasets.ipynb +++ b/examples/user_guide/07-Tabular_Datasets.ipynb @@ -87,7 +87,7 @@ "* 0D: BoxWhisker, Spikes, Distribution*, \n", "* 1D: Scatter, Curve, ErrorBars, Spread, Bars, BoxWhisker, Regression*\n", "* 2D: Points, HeatMap, Bars, BoxWhisker, Bivariate*\n", - "* 3D: Scatter3D, Trisurface, VectorField, BoxWhisker, Bars\n", + "* 3D: Scatter3D, TriSurface, VectorField, BoxWhisker, Bars\n", "\n", "\\* - requires Seaborn\n", "\n", diff --git a/holoviews/element/__init__.py b/holoviews/element/__init__.py index eacb066177..27fb2783eb 100644 --- a/holoviews/element/__init__.py +++ b/holoviews/element/__init__.py @@ -81,7 +81,7 @@ def surface(self, kdims=None, vdims=None, groupby=None, **kwargs): return Surface(heatmap.data, **dict(self._table.get_param_values(onlychanged=True))) def trisurface(self, kdims=None, vdims=None, groupby=None, **kwargs): - return self(Trisurface, kdims, vdims, groupby, **kwargs) + return self(TriSurface, kdims, vdims, groupby, **kwargs) def vectorfield(self, kdims=None, vdims=None, groupby=None, **kwargs): return self(VectorField, kdims, vdims, groupby, **kwargs) diff --git a/holoviews/element/chart3d.py b/holoviews/element/chart3d.py index dd938c89a0..39a62269c5 100644 --- a/holoviews/element/chart3d.py +++ b/holoviews/element/chart3d.py @@ -33,9 +33,9 @@ def __init__(self, data, kdims=None, vdims=None, extents=None, **params): -class Trisurface(Element3D, Scatter): +class TriSurface(Element3D, Scatter): """ - Trisurface object represents a number of coordinates in 3D-space, + TriSurface object represents a number of coordinates in 3D-space, represented as a Surface of triangular polygons. """ @@ -44,15 +44,27 @@ class Trisurface(Element3D, Scatter): Dimension('z')]) vdims = param.List(default=[], doc=""" - Trisurface can have optional value dimensions, + TriSurface can have optional value dimensions, which may be mapped onto color and size.""") - group = param.String(default='Trisurface', constant=True) + group = param.String(default='TriSurface', constant=True) def __getitem__(self, slc): return Chart.__getitem__(self, slc) +class Trisurface(TriSurface): + """ + Old name for TriSurface. Retaining for backwards compatibility till + holoviews 2.0. + """ + + group = param.String(default='Trisurface', constant=True) + + def __init__(self, *args, **kwargs): + self.warning('Please use TriSurface element instead') + super(TriSurface, self).__init__(*args, **kwargs) + class Scatter3D(Element3D, Scatter): """ diff --git a/holoviews/element/comparison.py b/holoviews/element/comparison.py index 5fadb04a21..6066527948 100644 --- a/holoviews/element/comparison.py +++ b/holoviews/element/comparison.py @@ -164,6 +164,7 @@ def register(cls): cls.equality_type_funcs[Area] = cls.compare_area cls.equality_type_funcs[Scatter] = cls.compare_scatter cls.equality_type_funcs[Scatter3D] = cls.compare_scatter3d + cls.equality_type_funcs[TriSurface] = cls.compare_trisurface cls.equality_type_funcs[Trisurface] = cls.compare_trisurface cls.equality_type_funcs[Histogram] = cls.compare_histogram cls.equality_type_funcs[Bars] = cls.compare_bars @@ -535,7 +536,7 @@ def compare_scatter3d(cls, el1, el2, msg='Scatter3D'): cls.compare_dataset(el1, el2, msg) @classmethod - def compare_trisurface(cls, el1, el2, msg='Trisurface'): + def compare_trisurface(cls, el1, el2, msg='TriSurface'): cls.compare_dataset(el1, el2, msg) @classmethod diff --git a/holoviews/plotting/mpl/__init__.py b/holoviews/plotting/mpl/__init__.py index 793feaa326..1be1d314fd 100644 --- a/holoviews/plotting/mpl/__init__.py +++ b/holoviews/plotting/mpl/__init__.py @@ -135,7 +135,8 @@ def grid_selector(grid): # Chart 3D Surface: SurfacePlot, - Trisurface: TrisurfacePlot, + TriSurface: TriSurfacePlot, + Trisurface: TriSurfacePlot, # Alias, remove in 2.0 Scatter3D: Scatter3DPlot, # Tabular plots diff --git a/holoviews/plotting/mpl/chart3d.py b/holoviews/plotting/mpl/chart3d.py index 4e3690f8fb..810658d3b7 100644 --- a/holoviews/plotting/mpl/chart3d.py +++ b/holoviews/plotting/mpl/chart3d.py @@ -188,9 +188,9 @@ def get_data(self, element, ranges, style): -class TrisurfacePlot(Plot3D): +class TriSurfacePlot(Plot3D): """ - Plots a trisurface given a Trisurface element, containing + Plots a trisurface given a TriSurface element, containing X, Y and Z coordinates. """ diff --git a/holoviews/plotting/plotly/__init__.py b/holoviews/plotting/plotly/__init__.py index d0bd93376c..35ba93d62f 100644 --- a/holoviews/plotting/plotly/__init__.py +++ b/holoviews/plotting/plotly/__init__.py @@ -34,7 +34,8 @@ # 3D Plot Scatter3D: Scatter3dPlot, Surface: SurfacePlot, - Trisurface: TrisurfacePlot, + TriSurface: TriSurfacePlot, + Trisurface: TriSurfacePlot, # Alias, remove in 2.0 # Tabular Table: TablePlot, @@ -62,7 +63,7 @@ options.ErrorBars = Options('style', color='black') options.Scatter = Options('style', color=Cycle()) options.Points = Options('style', color=Cycle()) -options.Trisurface = Options('style', cmap='viridis') +options.TriSurface = Options('style', cmap='viridis') # Rasters options.Image = Options('style', cmap=dflt_cmap) diff --git a/holoviews/plotting/plotly/chart3d.py b/holoviews/plotting/plotly/chart3d.py index f7ea2f909d..71a7df7938 100644 --- a/holoviews/plotting/plotly/chart3d.py +++ b/holoviews/plotting/plotly/chart3d.py @@ -87,7 +87,7 @@ def get_data(self, element, ranges): z=element.dimension_values(2)) -class TrisurfacePlot(ColorbarPlot, Chart3DPlot): +class TriSurfacePlot(ColorbarPlot, Chart3DPlot): style_opts = ['cmap'] @@ -95,7 +95,7 @@ def get_data(self, element, ranges): try: from scipy.spatial import Delaunay except: - SkipRendering("SciPy not available, cannot plot Trisurface") + SkipRendering("SciPy not available, cannot plot TriSurface") x, y, z = (element.dimension_values(i) for i in range(3)) points2D = np.vstack([x, y]).T tri = Delaunay(points2D)