Master list of potential Plotly backend enhancements
See original GitHub issueOverview
As discussed briefly in https://github.com/ioam/holoviews/pull/3194 with @philippjfr , this is an issue to catalog some of the ways that the plotly backend could be enhanced by taking advantage of existing plotly.py/plotly.js features. Feedback appreciated 🙂
Established Elements
The following elements are supported by matplotlib and/or bokeh and could also be supported with plotly.
- Text, Arrow, Labels (See https://plot.ly/python/text-and-annotations/)
- VLine, HLine, Box, Ellipse (See https://plot.ly/python/shapes/)
- Spikes (scatter line trace with gaps)
- Bars (See https://plot.ly/python/bar-charts/)
- Contours (with scatter lines traces if lines are precomputed)
- Area, Spread (See https://plot.ly/python/filled-area-plots/)
- RGB
- HSV
- Violin (This is a first-class trace with nice hover info, see https://plot.ly/python/violin/)
- Vectorfield (See https://plot.ly/python/quiver-plots/)
- Bivariate (See https://plot.ly/python/2d-histogram-contour/)
- Scatter with polar projection (First class trace type with polar specific zoom and rotation, see https://plot.ly/python/polar-chart/). This would also support
Curve
,Area
, andSpread
with polar projection. - Radialheatmap could be implemented with
barpolar
trace (See https://plot.ly/python/wind-rose-charts/) - Sankey (There is a nice first-class Sankey trace that support node/link tooltips and drag to reorder nodes, see https://plot.ly/python/sankey-diagram/)
- Hextiles (Not built in, but it’s been implemented from primitive shapes before, see https://plot.ly/~empet/13706/hexbin-plot/#/)
- Chord (Not built in, but it’s been worked through before, see https://plot.ly/python/filled-chord-diagram/)
- Graph. Could be done with scatter for node/edge tooltips. The highlighting of connected edges on hover would require custom JS though. See https://plot.ly/python/network-graphs/#create-network-graph
Potential new elements
The following are potential new elements that I don’t think are currently supported by matplotlib/bokeh (but if I’m wrong we can just bump them up to the previous section)
- Bar with polar projection: First class trace with zoom, rotation, etc. Also supports selection events.
- Parallel Coordinates: For multi-dimensional continuous datasets. WebGL accelerated, supports drag to reorder dimensions, and click-drag on axes to filter data.
- Parallel Categories: For multidimensional categorical datasets. Interactive drag to reorder categories and dimensions and supports click/hover events (See brushing examples in the docs)
- Carpet plot, Carpet scatter plot for representing 2 continuous independent variables and 1 continuous dependent variable. (also see https://en.wikipedia.org/wiki/Carpet_plot)
- Curve, Scatter, Points with ternary projection for 3 continuous dimensions constrained such that the 3-coordinates of each observation sum to 1.
- Dendrogram
- OHLC and Candlestick finance charts
- 3D Cone/Vectorfield: For representing a 3D vector field at discrete locations.
- 3D Streamtube for representing contunuous flow in 3D from particular starting points.
General Improvements / Fixes:
- Convert (Item)Table from figure factor to dedicated table trace type (https://plot.ly/python/table/). This trace type supports scrolling and can handle much larger tables.
-
Move fromReplaced by new subplot foundations in https://github.com/ioam/holoviews/pull/3255.plotly.tools.make_subplots
to usinglayout.grid
for laying out subplots. This way all trace types are supported (themake_subplots
approach only really supports 2D and 3D subplots, not tables, polar, etc.).
Streams
Plotly.js emits the events needed to detect selecting, clicking, and hovering over points in a trace. It also emits events in response to zoom and pan. It does not currently emit events for clicking and hovering the plot background (only when clicking or hover on particular points).
So I think it would be possible to support the, Selection1D, Range(X/Y), and Bounds(X/Y) streams across the elements based on scatter, scatter polar, bar, bar polar, ternary, and heatmap traces.
- Selection1D
- Range(X/Y)
- Bounds(X/Y)
There might be a bit of a mismatch with the click/hover events. since plotly.js associates these with points and it looks like Holoviews wants positions.
Datashader
With the RangeXY
stream and ability to display RGB
images I think it should be possible to support datashader. Here’s an example of wireing up datashader in plotly.py directly with FigureWidget
callbacks https://plot.ly/python/change-callbacks-datashader/.
Performance
All of plotly’s 3D trace types are WebGL accelerated. The 2D scatter trace (which would be used for the scatter, line, area, and spread elements) and scatter polar trace have both D3+SVG and WebGL implementations. The WebGL implementations support a million or so points and are pretty much feature complete so we would want to default to these, with the option of falling back to non-WebGL for generating static images in vector format.
Static image export
plotly.py recently got (standalone offline) static image export support, see https://plot.ly/python/static-image-export/. This is electron-based and so it was possible to package everything using conda without a dependency on a system web browser or webdriver. It supports raster (png, jpg, webp) and vector (svg, pdf, eps) image formats, and all formats support figures with multiple subplots. Note: All plot types can be output to vector formats, but stuff that’s rendered with webgl will be embedded in raster form.
LaTeX
Plotly supports rendering labels and annotations with LaTeX using MathJax. This is now supported in the Jupyter notebook, JupyterLab, in standalone html files, and in static image export (raster and vector). So this would make the plotly backend capable of supporting both interactive exploration and the generation of publication quality vector images with LaTeX typesetting.
Themes
Plotly recently got theming support (See https://medium.com/@plotlygraphs/introducing-plotly-py-theming-b644109ac9c7). It’s possible to configure a theme to be used by default, so it might not be necessary for Holoviews to be aware of them. But it might also be nice to be able to configure the current theme as an option.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:4
- Comments:6 (3 by maintainers)
Top GitHub Comments
That’s a very helpful list! And a lot of work. 😃 For my own work, I’m most interested in prioritizing the Potential new elements, particularly the 3D ones, to exploit the unique features of Plotly compared to the other HoloViews backends. But others may be interested in helping Plotly achieve feature parity with the other backends by fleshing out the Established Elements, so that HoloViews becomes a viable high-level API for working with Plotly.
FYI, I’ve started playing with adding support for the Selection1D stream. What I have is a bit of a mess, but I think I’ve worked out a rough approach for adding interactive stream support. Hopefully I’ll be able to get something in PR shape this week.