Skip to content

Commit

Permalink
Expose Graph node_marker option (#4255)
Browse files Browse the repository at this point in the history
* Expose Graph node_marker option

* Update reference notebook
  • Loading branch information
philippjfr committed Mar 4, 2020
1 parent 2429747 commit 33669de
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
7 changes: 2 additions & 5 deletions examples/reference/elements/bokeh/Graph.ipynb
Expand Up @@ -72,9 +72,7 @@
"source = np.zeros(N)\n",
"target = node_indices\n",
"\n",
"padding = dict(x=(-1.2, 1.2), y=(-1.2, 1.2))\n",
"\n",
"simple_graph = hv.Graph(((source, target),)).redim.range(**padding)\n",
"simple_graph = hv.Graph(((source, target),))\n",
"simple_graph"
]
},
Expand Down Expand Up @@ -148,8 +146,7 @@
"nodes = hv.Nodes((x, y, node_indices, node_labels), vdims='Type')\n",
"graph = hv.Graph(((source, target, edge_weights), nodes, paths), vdims='Weight')\n",
"\n",
"graph.redim.range(**padding).opts(node_color='Type', edge_color='Weight',\n",
" cmap=['blue', 'red'], edge_cmap='viridis')"
"graph.opts(node_color='Type', edge_color='Weight', cmap=['blue', 'red'], edge_cmap='viridis')"
]
},
{
Expand Down
3 changes: 2 additions & 1 deletion holoviews/plotting/bokeh/element.py
Expand Up @@ -1022,7 +1022,8 @@ def _apply_transforms(self, element, data, ranges, style, group=None):
if util.isscalar(val):
key = val
else:
key = {'field': k}
# Node marker does not handle {'field': ...}
key = k if k == 'node_marker' else {'field': k}
data[k] = val

# If color is not valid colorspec add colormapper
Expand Down
3 changes: 2 additions & 1 deletion holoviews/plotting/bokeh/graphs.py
Expand Up @@ -56,7 +56,8 @@ class GraphPlot(CompositeElementPlot, ColorbarPlot, LegendPlot):

style_opts = (['edge_'+p for p in fill_properties+line_properties] +
['node_'+p for p in fill_properties+line_properties] +
['node_size', 'cmap', 'edge_cmap', 'node_cmap', 'node_radius'])
['node_size', 'cmap', 'edge_cmap', 'node_cmap',
'node_radius', 'node_marker'])

_nonvectorized_styles = ['cmap', 'edge_cmap', 'node_cmap']

Expand Down

0 comments on commit 33669de

Please sign in to comment.