diff --git a/holoviews/plotting/plot.py b/holoviews/plotting/plot.py index b1567ed18e..d52171d6fa 100644 --- a/holoviews/plotting/plot.py +++ b/holoviews/plotting/plot.py @@ -655,7 +655,7 @@ def _get_frame(self, key): frame = get_plot_frame(self.hmap, key_map, cached) traverse_setter(self, '_force', False) - if not key in self.keys: + if not key in self.keys and self.dynamic: self.keys.append(key) self.current_frame = frame self.current_key = key diff --git a/holoviews/plotting/plotly/__init__.py b/holoviews/plotting/plotly/__init__.py index 549fc41cd8..0d3ee9be18 100644 --- a/holoviews/plotting/plotly/__init__.py +++ b/holoviews/plotting/plotly/__init__.py @@ -1,6 +1,6 @@ from ...core.options import Store, Cycle, Options from ...core import (Overlay, NdOverlay, Layout, NdLayout, GridSpace, - GridMatrix) + GridMatrix, config) from ...interface.seaborn import * # noqa (Element import for registration) from ...element import * # noqa (Element import for registration) from .renderer import PlotlyRenderer @@ -30,6 +30,7 @@ Raster: RasterPlot, Image: RasterPlot, HeatMap: HeatMapPlot, + QuadMesh: QuadMeshPlot, # 3D Plot Scatter3D: Scatter3dPlot, @@ -51,6 +52,7 @@ options = Store.options(backend='plotly') +dflt_cmap = 'hot' if config.style_17 else 'fire' point_size = np.sqrt(6) # Matches matplotlib default Cycle.default_cycles['default_colors'] = ['#30a2da', '#fc4f30', '#e5ae38', @@ -62,3 +64,9 @@ options.Scatter = Options('style', color=Cycle()) options.Points = Options('style', color=Cycle()) options.Trisurface = Options('style', cmap='viridis') + +# Rasters +options.Image = Options('style', cmap=dflt_cmap) +options.Raster = Options('style', cmap=dflt_cmap) +options.QuadMesh = Options('style', cmap=dflt_cmap) +options.HeatMap = Options('style', cmap='RdBu_r') diff --git a/holoviews/plotting/plotly/chart.py b/holoviews/plotting/plotly/chart.py index 027f576f31..220ed11c8e 100644 --- a/holoviews/plotting/plotly/chart.py +++ b/holoviews/plotting/plotly/chart.py @@ -12,7 +12,7 @@ class ScatterPlot(ColorbarPlot): allow_None=True, doc=""" Index of the dimension from which the color will the drawn""") - style_opts = ['symbol', 'color', 'cmap', 'fillcolor', 'opacity'] + style_opts = ['symbol', 'color', 'cmap', 'fillcolor', 'opacity', 'fill', 'marker', 'size'] graph_obj = go.Scatter @@ -216,3 +216,6 @@ def generate_plot(self, key, ranges): fig = go.Figure(data=plots, layout=layout) self.handles['fig'] = fig return fig + + def get_extents(self, element, ranges): + return (None, None, None, None) diff --git a/holoviews/plotting/plotly/element.py b/holoviews/plotting/plotly/element.py index 7175ec5e46..39e544c8c8 100644 --- a/holoviews/plotting/plotly/element.py +++ b/holoviews/plotting/plotly/element.py @@ -1,6 +1,8 @@ +import numpy as np import plotly.graph_objs as go import param +from ...core.util import basestring from .plot import PlotlyPlot from ..plot import GenericElementPlot, GenericOverlayPlot from .. import util @@ -211,7 +213,18 @@ def get_color_opts(self, dim, element, ranges, style): else: opts['showscale'] = False - opts['colorscale'] = style.pop('cmap', 'viridis') + cmap = style.pop('cmap', 'viridis') + if cmap == 'fire': + values = np.linspace(0, 1, len(util.fire_colors)) + cmap = [(v, 'rgb(%d, %d, %d)' % tuple(c)) + for v, c in zip(values, np.array(util.fire_colors)*255)] + elif isinstance(cmap, basestring): + if cmap[0] == cmap[0].lower(): + cmap = cmap[0].upper() + cmap[1:] + if cmap.endswith('_r'): + cmap = cmap[:-2] + opts['reversescale'] = True + opts['colorscale'] = cmap if dim: cmin, cmax = ranges.get(dim.name, element.range(dim.name)) opts['cmin'] = cmin diff --git a/holoviews/plotting/plotly/raster.py b/holoviews/plotting/plotly/raster.py index 713ef14e8a..e0e163ad09 100644 --- a/holoviews/plotting/plotly/raster.py +++ b/holoviews/plotting/plotly/raster.py @@ -39,9 +39,10 @@ def get_extents(self, element, ranges): return (np.NaN,)*4 def get_data(self, element, ranges): - return (), dict(x=unique_array(element.dimension_values(0, False)), - y=unique_array(element.dimension_values(1, False)), - z=np.flipud(element.raster)) + gridded = element.gridded.sort() + return (), dict(x=gridded.dimension_values(0, False), + y=gridded.dimension_values(1, False), + z=gridded.dimension_values(2, flat=False)) class QuadMeshPlot(RasterPlot): diff --git a/holoviews/plotting/plotly/tabular.py b/holoviews/plotting/plotly/tabular.py index ec59db76f0..153076eca1 100644 --- a/holoviews/plotting/plotly/tabular.py +++ b/holoviews/plotting/plotly/tabular.py @@ -1,5 +1,5 @@ import param -from plotly.tools import FigureFactory as FF +from plotly.figure_factory import create_table from .element import ElementPlot @@ -16,7 +16,7 @@ def get_data(self, element, ranges): return (headings+data,), {} def init_graph(self, plot_args, plot_kwargs): - return FF.create_table(*plot_args, **plot_kwargs) + return create_table(*plot_args, **plot_kwargs) def graph_options(self, element, ranges):