Skip to content

Commit

Permalink
Pass through bokeh examples gallery renaming .options to .opts (#3273)
Browse files Browse the repository at this point in the history
  • Loading branch information
jlstevens authored and philippjfr committed Dec 11, 2018
1 parent d21c1d7 commit b0490fb
Show file tree
Hide file tree
Showing 41 changed files with 61 additions and 61 deletions.
4 changes: 2 additions & 2 deletions examples/gallery/demos/bokeh/area_chart.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,9 @@
"metadata": {},
"outputs": [],
"source": [
"opts.defaults(opts.Area(fill_alpha=0.5))\n",
"overlay = (python * pypy * jython)\n",
"layout = overlay.relabel(\"Area Chart\") + hv.Area.stack(overlay).relabel(\"Stacked Area Chart\")\n",
"layout.options(opts.Area(fill_alpha=0.5))"
"overlay.relabel(\"Area Chart\") + hv.Area.stack(overlay).relabel(\"Stacked Area Chart\")"
]
}
],
Expand Down
4 changes: 2 additions & 2 deletions examples/gallery/demos/bokeh/autompg_histogram.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@
"metadata": {},
"outputs": [],
"source": [
"hist = autompg_ds.hist(dimension='mpg', groupby='cyl', bin_range=(9, 46), bins=40, adjoin=False)\n",
"hist.options(opts.Histogram(alpha=0.9, width=600))"
"opts.defaults(opts.Histogram(alpha=0.9, width=600))\n",
"autompg_ds.hist(dimension='mpg', groupby='cyl', bin_range=(9, 46), bins=40, adjoin=False)"
]
}
],
Expand Down
2 changes: 1 addition & 1 deletion examples/gallery/demos/bokeh/autompg_violins.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
"metadata": {},
"outputs": [],
"source": [
"violin.options(height=500, width=900, violin_fill_color=dim('Year').str(), cmap='Set1')"
"violin.opts(height=500, width=900, violin_fill_color=dim('Year').str(), cmap='Set1')"
]
}
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@
"\n",
"gridstyle = {'grid_line_dash': [6, 4], 'grid_line_width': 3, 'grid_bounds': (0, 100)}\n",
"\n",
"overlay.options(\n",
"overlay.opts(\n",
" opts.Curve(show_frame=False, labelled=[], tools=['hover'],\n",
" height=900, width=900, show_legend=False, xticks=[1970, 1980, 1990, 2000, 2010],\n",
" color=hv.Cycle(values=color_sequence), line_width=2, show_grid=True, yformatter='%d%%'),\n",
Expand Down
2 changes: 1 addition & 1 deletion examples/gallery/demos/bokeh/bars_economic.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
"outputs": [],
"source": [
"bars = macro.to.bars(['Year', 'Country'], 'Trade', [])\n",
"bars.options(\n",
"bars.opts(\n",
" opts.Bars(color=hv.Cycle('Category20'), show_legend=False, stacked=True, \n",
" tools=['hover'], width=600, xrotation=90))"
]
Expand Down
2 changes: 1 addition & 1 deletion examples/gallery/demos/bokeh/box_draw_roi_editor.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
"outputs": [],
"source": [
"im = ds.to(hv.Image, ['x', 'y'], dynamic=True)\n",
"(im * polys + dmap * hlines).options(\n",
"(im * polys + dmap * hlines).opts(\n",
" opts.Curve(width=400, framewise=True), \n",
" opts.Polygons(fill_alpha=0.2, line_color='white'), \n",
" opts.VLine(color='black'))"
Expand Down
2 changes: 1 addition & 1 deletion examples/gallery/demos/bokeh/boxplot_chart.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
"metadata": {},
"outputs": [],
"source": [
"boxwhisker.options(show_legend=False, width=600, box_fill_color=dim('origin').str(), cmap='Set1')"
"boxwhisker.opts(show_legend=False, width=600, box_fill_color=dim('origin').str(), cmap='Set1')"
]
}
],
Expand Down
4 changes: 2 additions & 2 deletions examples/gallery/demos/bokeh/choropleth_data_link.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,10 @@
"# Link the choropleth and the table\n",
"DataLink(choropleth, table)\n",
"\n",
"(choropleth + table).options(\n",
"(choropleth + table).opts(\n",
" opts.Table(height=428),\n",
" opts.Polygons(width=500, height=500, tools=['hover', 'tap'], xaxis=None, \n",
" yaxis=None, color_index='Unemployment'), clone=False)"
" yaxis=None, color_index='Unemployment'))"
]
}
],
Expand Down
2 changes: 1 addition & 1 deletion examples/gallery/demos/bokeh/directed_airline_routes.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
"metadata": {},
"outputs": [],
"source": [
"(as_graph * labels).options(\n",
"(as_graph * labels).opts(\n",
" opts.Graph(directed=True, node_size=8, padding=0.1, bgcolor='gray', xaxis=None, yaxis=None,\n",
" edge_line_color='white', edge_line_width=1, width=800, height=800, arrowhead_length=0.01,\n",
" node_fill_color='white', node_nonselection_fill_color='black'),\n",
Expand Down
2 changes: 1 addition & 1 deletion examples/gallery/demos/bokeh/dot_example.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
"metadata": {},
"outputs": [],
"source": [
"(heatmap + spikes * scatter).options(\n",
"(heatmap + spikes * scatter).opts(\n",
" opts.Scatter(size=15, fill_color=\"orange\", line_color=\"green\"),\n",
" opts.Spikes(color='green', line_width=4, labelled=[], invert_axes=True, color_index=None),\n",
" opts.Layout(shared_axes=False))"
Expand Down
6 changes: 3 additions & 3 deletions examples/gallery/demos/bokeh/dragon_curve.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,9 @@
"for i in range(7,17):\n",
" hmap[i] = DragonCurve(-200, 0, i).path\n",
"\n",
"hmap.options(\n",
" opts.Path(axiswise=False, color='black', framewise=True, line_width=1, \n",
" padding=0.1, title_format='', xaxis=None, yaxis=None))"
"hmap.opts(\n",
" opts.Path(axiswise=False, color='black', line_width=1, \n",
" padding=0.1, title_format='', xaxis=None, yaxis=None, framewise=True))"
]
}
],
Expand Down
2 changes: 1 addition & 1 deletion examples/gallery/demos/bokeh/dropdown_economic.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
"annotations = hv.Arrow(1973, 8, 'Oil Crisis', 'v') * hv.Arrow(1975, 6, 'Stagflation', 'v') *\\\n",
"hv.Arrow(1979, 8, 'Energy Crisis', 'v') * hv.Arrow(1981.9, 5, 'Early Eighties\\n Recession', 'v')\n",
"\n",
"(gdp_curves * gdp_unem_scatter* annotations).options(\n",
"(gdp_curves * gdp_unem_scatter* annotations).opts(\n",
" opts.Curve(color='k'), \n",
" opts.Scatter(cmap='Blues', color='Unemployment', \n",
" line_color='k', size=dim('Unemployment')*1.5),\n",
Expand Down
2 changes: 1 addition & 1 deletion examples/gallery/demos/bokeh/emoji_tsne.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
"metadata": {},
"outputs": [],
"source": [
"emojis.options(width=1000, height=800, xaxis=None, yaxis=None)"
"emojis.opts(width=1000, height=800, xaxis=None, yaxis=None)"
]
}
],
Expand Down
2 changes: 1 addition & 1 deletion examples/gallery/demos/bokeh/energy_sankey.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"outputs": [],
"source": [
"sankey = hv.Sankey(edges, label='Energy Diagram')\n",
"sankey.options(label_position='left', edge_color='target', node_color='index', cmap='tab20')"
"sankey.opts(label_position='left', edge_color='target', node_color='index', cmap='tab20')"
]
}
],
Expand Down
2 changes: 1 addition & 1 deletion examples/gallery/demos/bokeh/hextile_movie_ratings.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
"metadata": {},
"outputs": [],
"source": [
"(hextiles * bivariate).options(\n",
"(hextiles * bivariate).opts(\n",
" opts.Bivariate(show_legend=False),\n",
" opts.HexTiles(width=500, height=500, min_count=0))"
]
Expand Down
5 changes: 1 addition & 4 deletions examples/gallery/demos/bokeh/histogram_example.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -118,11 +118,8 @@
"metadata": {},
"outputs": [],
"source": [
"options = {'Histogram': dict(fill_color=\"#036564\", axiswise=True, height=350, width=350, bgcolor=\"#E8DDCB\"),\n",
" 'Curve': dict(axiswise=True), 'Layout': dict(shared_axes=False)}\n",
"\n",
"layout = (norm + lognorm + gamma + beta + weibull).cols(2)\n",
"layout.options(\n",
"layout.opts(\n",
" opts.Curve(axiswise=True),\n",
" opts.Histogram(fill_color=\"#036564\", axiswise=True, height=350, width=350, bgcolor=\"#E8DDCB\"),\n",
" opts.Layout(shared_axes=False))"
Expand Down
5 changes: 3 additions & 2 deletions examples/gallery/demos/bokeh/image_range_tool.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,9 @@
"# Declare a RangeToolLink between the x- and y-axes of the two plots\n",
"RangeToolLink(src, tgt, axes=['x', 'y'])\n",
"\n",
"(tgt + src).options(\n",
" opts.Layout(shared_axes=False), clone=False)"
"(tgt + src).opts(\n",
" opts.Image(default_tools=[]),\n",
" opts.Layout(shared_axes=False))"
]
}
],
Expand Down
2 changes: 1 addition & 1 deletion examples/gallery/demos/bokeh/iris_density_grid.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
"density_grid = gridmatrix(iris_ds, diagonal_type=hv.Distribution, chart_type=hv.Bivariate)\n",
"point_grid = gridmatrix(iris_ds, chart_type=hv.Points)\n",
"\n",
"(density_grid * point_grid).options(\n",
"(density_grid * point_grid).opts(\n",
" opts.Bivariate(bandwidth=0.5, cmap='Blues'), \n",
" opts.Points(size=2, tools=['box_select']))"
]
Expand Down
2 changes: 1 addition & 1 deletion examples/gallery/demos/bokeh/iris_example.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
"metadata": {},
"outputs": [],
"source": [
"points.options(legend_position='right', toolbar='above', width=400)"
"points.opts(legend_position='right', toolbar='above', width=400)"
]
}
],
Expand Down
4 changes: 2 additions & 2 deletions examples/gallery/demos/bokeh/iris_grouped_grid.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"source": [
"import holoviews as hv\n",
"from holoviews import opts\n",
"hv.extension('bokeh', width=95)"
"hv.extension('bokeh')"
]
},
{
Expand Down Expand Up @@ -55,7 +55,7 @@
"density_grid = gridmatrix(iris_ds, diagonal_type=hv.Distribution, chart_type=hv.Bivariate)\n",
"point_grid = gridmatrix(iris_ds, chart_type=hv.Points)\n",
"\n",
"(density_grid * point_grid).options(\n",
"(density_grid * point_grid).opts(\n",
" opts.Bivariate(bandwidth=0.5, cmap=hv.Cycle(values=['Blues', 'Reds', 'Oranges'])),\n",
" opts.Points(size=2, alpha=0.5),\n",
" opts.NdOverlay(batched=False))"
Expand Down
2 changes: 1 addition & 1 deletion examples/gallery/demos/bokeh/iris_splom_example.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
"metadata": {},
"outputs": [],
"source": [
"grid.options(opts.Scatter(tools=['hover', 'box_select'], bgcolor='#efe8e2', fill_alpha=0.2, size=4))"
"grid.opts(opts.Scatter(tools=['hover', 'box_select'], bgcolor='#efe8e2', fill_alpha=0.2, size=4))"
]
}
],
Expand Down
10 changes: 5 additions & 5 deletions examples/gallery/demos/bokeh/legend_example.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,13 @@
"y = np.sin(x)\n",
"\n",
"scatter1 = hv.Scatter((x, y), label='sin(x)')\n",
"scatter2 = hv.Scatter((x, y*2), label='2*sin(x)').options(color='orange')\n",
"scatter3 = hv.Scatter((x, y*3), label='3*sin(x)').options(color='green')\n",
"scatter4 = hv.Scatter(scatter3).options(line_color='green', marker='square', fill_alpha=0, size=5)\n",
"scatter2 = hv.Scatter((x, y*2), label='2*sin(x)').opts(color='orange')\n",
"scatter3 = hv.Scatter((x, y*3), label='3*sin(x)').opts(color='green')\n",
"scatter4 = hv.Scatter(scatter3).opts(line_color='green', marker='square', fill_alpha=0, size=5)\n",
"\n",
"curve1 = hv.Curve(scatter1)\n",
"curve2 = hv.Curve(scatter2).options(line_dash=(4, 4), color='orange')\n",
"curve3 = hv.Curve(scatter3).options(color='orange')"
"curve2 = hv.Curve(scatter2).opts(line_dash=(4, 4), color='orange')\n",
"curve3 = hv.Curve(scatter3).opts(color='orange')"
]
},
{
Expand Down
4 changes: 2 additions & 2 deletions examples/gallery/demos/bokeh/lesmis_example.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
" 'Purples', 'Oranges', 'Greys', 'Greys', 'PuRd', 'Reds', 'Greys']\n",
"\n",
"combined = hv.Overlay([o.options(cmap=cm).sort() for o, cm in zip(overlaid, cmaps)], label='LesMis Occurences')\n",
"styled = combined.options(\n",
"styled = combined.opts(\n",
" opts.HeatMap(logz=True, clipping_colors={'NaN':(1,1,1,0.)},\n",
" xaxis='top', xrotation=90,\n",
" fontsize={'ticks': '7pt', 'title': '18pt'}, invert_xaxis=True, tools=['hover'],\n",
Expand All @@ -93,7 +93,7 @@
"metadata": {},
"outputs": [],
"source": [
"hv.Layout([el.options(width=300, height=300) for el in styled if len(el)>10][:-1],\n",
"hv.Layout([el.opts(width=300, height=300) for el in styled if len(el)>10][:-1],\n",
" label='LesMis Large Clusters').cols(3)"
]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
"metadata": {},
"outputs": [],
"source": [
"lorenzian.options(opts.Path(color=hv.Palette('Blues')))"
"lorenzian.opts(opts.Path(color=hv.Palette('Blues'), width=600, height=600))"
]
}
],
Expand Down
4 changes: 3 additions & 1 deletion examples/gallery/demos/bokeh/mandelbrot_section.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,9 @@
" for y in np.linspace(-0.3, 0.3, 11)} # Half the frames of the bokeh version\n",
"\n",
"composition = hv.HoloMap(layouts, kdims='Y').collate().cols(2)\n",
"composition.options(opts.Contours(show_legend=False), opts.Points(scaling_factor=50))"
"composition.opts(\n",
" opts.Contours(show_legend=False), \n",
" opts.Points(scaling_factor=50))"
]
}
],
Expand Down
2 changes: 1 addition & 1 deletion examples/gallery/demos/bokeh/measles_example.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
"outputs": [],
"source": [
"overlay = (heatmap + agg * vline * marker).cols(1)\n",
"overlay.options(\n",
"overlay.opts(\n",
" opts.HeatMap(width=900, height=500, tools=['hover'], logz=True, \n",
" invert_yaxis=True, labelled=[], toolbar='above', xaxis=None),\n",
" opts.VLine(line_color='black'),\n",
Expand Down
2 changes: 1 addition & 1 deletion examples/gallery/demos/bokeh/network_graph.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
"fb_graph = fb_graph.redim.range(x=(-0.05, 1.05), \n",
" y=(-0.05, 1.05)\n",
" )\n",
"fb_graph.options(color_index='circle', width=800, height=800, show_frame=False,\n",
"fb_graph.opts(color_index='circle', width=800, height=800, show_frame=False,\n",
" xaxis=None, yaxis=None,node_size=10, edge_line_width=1, cmap=colors)"
]
}
Expand Down
6 changes: 3 additions & 3 deletions examples/gallery/demos/bokeh/nyc_airport_connections.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@
"np.random.seed(14)\n",
"graph = layout_nodes(nyc_graph, layout=nx.layout.fruchterman_reingold_layout, kwargs={'weight': 'connections'})\n",
"labels = hv.Labels(graph.nodes, ['x', 'y'], ['IATA', 'City'])\n",
"nyc_labels = labels.select(City='New York').options(text_color='white', yoffset=0.05, text_font_size='16pt')\n",
"other_labels = labels[labels['City']!='New York'].options(text_color='white', text_font_size='8pt')"
"nyc_labels = labels.select(City='New York').opts(text_color='white', yoffset=0.05, text_font_size='16pt')\n",
"other_labels = labels[labels['City']!='New York'].opts(text_color='white', text_font_size='8pt')"
]
},
{
Expand All @@ -71,7 +71,7 @@
"source": [
"plot = (graph * nyc_labels * other_labels).relabel('NYC Airport Connections')\n",
"\n",
"plot.options(\n",
"plot.opts(\n",
" opts.Graph(bgcolor='gray', edge_color=dim('SourceID').categorize({3697: 'red', 3797: 'blue'}, 'gray'), \n",
" node_color=dim('index').categorize({3697: 'red', 3797: 'blue'}, 'gray'), width=800, height=800, \n",
" xaxis=None, yaxis=None, xlim=(-1.2, 1.2), ylim=(-1.2, 1.2))\n",
Expand Down
2 changes: 1 addition & 1 deletion examples/gallery/demos/bokeh/nyc_radial_heatmap.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
"outputs": [],
"source": [
"xticks = (\"Friday\", \"Saturday\", \"Sunday\", \"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\")\n",
"heatmap.options(\n",
"heatmap.opts(\n",
" opts.HeatMap(radial=True, start_angle=np.pi*19/14, width=600, height=600, \n",
" yticks=None, xticks=xticks, xmarks=7, ymarks=3))"
]
Expand Down
2 changes: 1 addition & 1 deletion examples/gallery/demos/bokeh/point_draw_triangulate.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"metadata": {},
"outputs": [],
"source": [
"(trimesh * points).options(\n",
"(trimesh * points).opts(\n",
" opts.Points(width=500, height=500, size=10, line_color='black', nonselection_alpha=0.3))"
]
},
Expand Down
6 changes: 3 additions & 3 deletions examples/gallery/demos/bokeh/quiver_demo.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
"angle = (np.pi/2.) - np.arctan2(U/mag, V/mag)\n",
"vectorfield = hv.VectorField((X.flat, Y.flat, angle.flat, mag.flat)\n",
" ).relabel('Arrows scale with plot width, not view')\n",
"vectorfield.options(width=500)"
"vectorfield.opts(width=500)"
]
},
{
Expand All @@ -70,7 +70,7 @@
"source": [
"composition = (hv.VectorField((xs[::3], ys[::3], angle[::3, ::3], mag[::3, ::3])).options(width=500)\n",
" * hv.Scatter((X[::3, ::3].flat, Y[::3, ::3].flat))).relabel(group=\"pivot='mid'; every third arrow\")\n",
"composition.options(opts.Scatter(color='red'))"
"composition.opts(opts.Scatter(color='red'))"
]
},
{
Expand All @@ -81,7 +81,7 @@
"source": [
"points = hv.Points((X.flat, Y.flat)) \n",
"vectorfield = hv.VectorField((xs, ys, angle, mag), label=\"pivot='tip'; scales with x view\") \n",
"(points * vectorfield).options(\n",
"(points * vectorfield).opts(\n",
" hv.opts.VectorField(width=500, magnitude='Magnitude', color='Magnitude', pivot='tip', line_width=2))"
]
}
Expand Down
2 changes: 1 addition & 1 deletion examples/gallery/demos/bokeh/route_chord.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
"metadata": {},
"outputs": [],
"source": [
"busiest_airports.options(\n",
"busiest_airports.opts(\n",
" opts.Chord(cmap='Category20', edge_color=dim('SourceID').str(), \n",
" height=800, labels='City', node_color=dim('AirportID').str(), width=800))"
]
Expand Down
2 changes: 1 addition & 1 deletion examples/gallery/demos/bokeh/scatter_economic.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
"source": [
"gdp_unem_scatter = macro.to.scatter('Year', ['GDP Growth', 'Unemployment'])\n",
"overlay = gdp_unem_scatter.overlay('Country')\n",
"overlay.options(\n",
"overlay.opts(\n",
" opts.Scatter(width=700, height=400, scaling_method='width', scaling_factor=2, \n",
" size_index=2, show_grid=True, color=hv.Cycle('Category20'), line_color='k'),\n",
" opts.NdOverlay(legend_position='left', show_frame=False)\n",
Expand Down
2 changes: 1 addition & 1 deletion examples/gallery/demos/bokeh/square_limit.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@
"smallfish = flip(rot45(fish))\n",
"t = fish * smallfish * rot(rot(rot(smallfish)))\n",
"u = smallfish * rot(smallfish) * rot(rot(smallfish)) * rot(rot(rot(smallfish)))\n",
"squarelimit(3,u,t).options(\n",
"squarelimit(3,u,t).opts(\n",
" opts.Spline(width=600, height=600, xaxis=None, yaxis=None))"
]
}
Expand Down
2 changes: 1 addition & 1 deletion examples/gallery/demos/bokeh/step_chart.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
"metadata": {},
"outputs": [],
"source": [
"postage.options(\n",
"postage.opts(\n",
" opts.Curve(interpolation='steps-mid', width=400, height=400, \n",
" line_dash=hv.Cycle(values=['dashed', 'solid'])),\n",
" opts.Overlay(legend_position='top_left'))"
Expand Down
Loading

0 comments on commit b0490fb

Please sign in to comment.