Skip to content

Commit

Permalink
Trisurface renamed to TriSurface (#2219)
Browse files Browse the repository at this point in the history
  • Loading branch information
jlstevens authored and philippjfr committed Feb 11, 2018
1 parent 7e77c33 commit feca74c
Show file tree
Hide file tree
Showing 16 changed files with 63 additions and 48 deletions.
12 changes: 6 additions & 6 deletions doc/Tutorials/Bokeh_Elements.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
"<dl class=\"dl-horizontal\">\n",
" <dt><a href=\"#Surface\"><code>Surface</code></a></dt><dd>Continuous collection of points in a three-dimensional space. <font color='red'>&#x2717;</font></dd>\n",
" <dt><a href=\"#Scatter3D\"><code>Scatter3D</code></a></dt><dd>Discontinuous collection of points in a three-dimensional space. <font color='red'>&#x2717;</font></dd>\n",
" <dt><a href=\"#Trisurface\"><code>Trisurface</code></a></dt><dd>Continuous but irregular collection of points interpolated into a Surface using Delaunay triangulation. <font color='red'>&#x2717;</font></dd>\n",
" <dt><a href=\"#TriSurface\"><code>TriSurface</code></a></dt><dd>Continuous but irregular collection of points interpolated into a Surface using Delaunay triangulation. <font color='red'>&#x2717;</font></dd>\n",
"</dl>\n",
"\n",
"\n",
Expand Down Expand Up @@ -763,14 +763,14 @@
"``Scatter3D`` is the equivalent of ``Scatter`` but for two key dimensions, rather than just one.\n",
"\n",
"\n",
"### ``Trisurface`` <a id='Trisurface'></a>"
"### ``TriSurface`` <a id='TriSurface'></a>"
]
},
{
"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."
]
},
{
Expand All @@ -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))"
]
},
{
Expand Down Expand Up @@ -1418,5 +1418,5 @@
}
},
"nbformat": 4,
"nbformat_minor": 0
"nbformat_minor": 1
}
2 changes: 1 addition & 1 deletion doc/Tutorials/Columnar_Data.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
12 changes: 6 additions & 6 deletions doc/Tutorials/Elements.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
"<dl class=\"dl-horizontal\">\n",
" <dt><a href=\"#Surface\"><code>Surface</code></a></dt><dd>Continuous collection of points in a three-dimensional space.</dd>\n",
" <dt><a href=\"#Scatter3D\"><code>Scatter3D</code></a></dt><dd>Discontinuous collection of points in a three-dimensional space.</dd>\n",
" <dt><a href=\"#Trisurface\"><code>Trisurface</code></a></dt><dd>Continuous but irregular collection of points interpolated into a Surface using Delaunay triangulation.</dd>\n",
" <dt><a href=\"#TriSurface\"><code>TriSurface</code></a></dt><dd>Continuous but irregular collection of points interpolated into a Surface using Delaunay triangulation.</dd>\n",
"</dl>\n",
"\n",
"\n",
Expand Down Expand Up @@ -796,14 +796,14 @@
"``Scatter3D`` is the equivalent of ``Scatter`` but for two key dimensions, rather than just one.\n",
"\n",
"\n",
"### ``Trisurface`` <a id='Trisurface'></a>"
"### ``TriSurface`` <a id='TriSurface'></a>"
]
},
{
"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."
]
},
{
Expand All @@ -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))"
]
},
{
Expand Down Expand Up @@ -1454,5 +1454,5 @@
}
},
"nbformat": 4,
"nbformat_minor": 0
"nbformat_minor": 1
}
6 changes: 3 additions & 3 deletions doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
paths = ['../param/', '.', '..']
add_paths(paths)

from ..setup import setup_args
#from ..setup import setup_args

# Declare information specific to this project.
project = u'HoloViews'
Expand All @@ -22,9 +22,9 @@
# built documents.
#
# The short X.Y version.
version = setup_args['version']
version = 'v1.9.3' #setup_args['version']
# The full version, including alpha/beta/rc tags.
release = setup_args['version']
release = 'v1.9.3' #setup_args['version']

ASSETS_URL = 'http://assets.holoviews.org'

Expand Down
2 changes: 1 addition & 1 deletion examples/gallery/demos/matplotlib/trisurf3d_demo.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -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))"
]
},
{
Expand Down
2 changes: 1 addition & 1 deletion examples/gallery/demos/plotly/trisurf3d_demo.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -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))"
]
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
"source": [
"<div class=\"contentcontainer med left\" style=\"margin-left: -50px;\">\n",
"<dl class=\"dl-horizontal\">\n",
" <dt>Title</dt> <dd> Trisurface Element</dd>\n",
" <dt>Title</dt> <dd> TriSurface Element</dd>\n",
" <dt>Dependencies</dt> <dd>Matplotlib</dd>\n",
" <dt>Backends</dt> <dd><a href='../matplotlib/Trisurface.ipynb'>Matplotlib</a></dd>\n",
" <dt>Backends</dt> <dd><a href='../matplotlib/TriSurface.ipynb'>Matplotlib</a></dd>\n",
"\n",
"</dl>\n",
"</div>"
Expand All @@ -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:"
]
},
{
Expand All @@ -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))"
]
},
{
Expand All @@ -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",
Expand All @@ -71,15 +71,15 @@
"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"
]
},
{
"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).``"
]
}
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
"source": [
"<div class=\"contentcontainer med left\" style=\"margin-left: -50px;\">\n",
"<dl class=\"dl-horizontal\">\n",
" <dt>Title</dt> <dd> Trisurface Element</dd>\n",
" <dt>Title</dt> <dd> TriSurface Element</dd>\n",
" <dt>Dependencies</dt> <dd>Matplotlib</dd>\n",
" <dt>Backends</dt> <dd><a href='../matplotlib/Trisurface.ipynb'>Matplotlib</a></dd> <dd><a href='./Trisurface.ipynb'>Plotly</a></dd>\n",
" <dt>Backends</dt> <dd><a href='../matplotlib/TriSurface.ipynb'>Matplotlib</a></dd> <dd><a href='./TriSurface.ipynb'>Plotly</a></dd>\n",
"</dl>\n",
"</div>"
]
Expand All @@ -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:"
]
},
{
Expand All @@ -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))"
]
},
{
Expand All @@ -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",
Expand All @@ -70,15 +70,15 @@
"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"
]
},
{
"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).``"
]
}
],
Expand Down
2 changes: 1 addition & 1 deletion examples/topics/simulation/sri_model.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion holoviews/element/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
20 changes: 16 additions & 4 deletions holoviews/element/chart3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
"""

Expand All @@ -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):
"""
Expand Down
3 changes: 2 additions & 1 deletion holoviews/element/comparison.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion holoviews/plotting/mpl/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions holoviews/plotting/mpl/chart3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
"""

Expand Down
5 changes: 3 additions & 2 deletions holoviews/plotting/plotly/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@
# 3D Plot
Scatter3D: Scatter3dPlot,
Surface: SurfacePlot,
Trisurface: TrisurfacePlot,
TriSurface: TriSurfacePlot,
Trisurface: TriSurfacePlot, # Alias, remove in 2.0

# Tabular
Table: TablePlot,
Expand Down Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions holoviews/plotting/plotly/chart3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,15 +87,15 @@ def get_data(self, element, ranges):
z=element.dimension_values(2))


class TrisurfacePlot(ColorbarPlot, Chart3DPlot):
class TriSurfacePlot(ColorbarPlot, Chart3DPlot):

style_opts = ['cmap']

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)
Expand Down

0 comments on commit feca74c

Please sign in to comment.