Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
ChakriCherukuri committed Mar 22, 2019
1 parent 363a892 commit 128c0de
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions examples/Tutorials/Linking Plots With Widgets.ipynb
Expand Up @@ -20,7 +20,7 @@
"* `bqplot` is built on top of the `ipywidgets` framework\n",
"* `ipwidgets` and `bqplot` widgets can be seamlessly integrated to build interactive plots\n",
"* `bqplot` figure widgets can be stacked with UI controls available in `ipywidgets` by using `Layout` classes (Box, HBox, VBox) in `ipywidgets`\n",
"(Not that *only* `Figure` objects (not `Mark` objects) inherit from `DOMWidget` class, and so can be combined with other widgets from `ipywidgets`)\n",
"(Note that *only* `Figure` objects (not `Mark` objects) inherit from `DOMWidget` class and can be combined with other widgets from `ipywidgets`)\n",
"* Trait attributes of widgets can be linked using callbacks. Callbacks should be registered using the `observe` method\n",
"\n",
"Please follow these links for detailed documentation on:\n",
Expand Down Expand Up @@ -83,7 +83,7 @@
"update_btn = Button(description='Update', button_style='success')\n",
"\n",
"# create a figure widget\n",
"fig = plt.figure(animation_duration=750)\n",
"fig1 = plt.figure(animation_duration=750)\n",
"line = plt.plot(y)\n",
"\n",
"# define an on_click function\n",
Expand All @@ -95,7 +95,7 @@
"update_btn.on_click(lambda btn: on_btn_click())\n",
" \n",
"# stack button and figure using VBox\n",
"VBox([fig, update_btn])"
"VBox([fig1, update_btn])"
]
},
{
Expand Down Expand Up @@ -145,8 +145,8 @@
"# create figure for plotting time series\n",
"current_ticker = dropdown.value\n",
"fig_title_tmpl = '\"{}\" Time Series' # string template for title of the figure \n",
"fig = plt.figure(title=fig_title_tmpl.format(current_ticker))\n",
"fig.layout.width = '900px'\n",
"fig2 = plt.figure(title=fig_title_tmpl.format(current_ticker))\n",
"fig2.layout.width = '900px'\n",
"time_series = plt.plot(dates, prices[current_ticker])\n",
"plt.xlabel('Date')\n",
"plt.ylabel('Price')\n",
Expand All @@ -160,13 +160,13 @@
" time_series.y = prices[selected_ticker]\n",
" \n",
" # update the title of the figure\n",
" fig.title = fig_title_tmpl.format(selected_ticker)\n",
" fig2.title = fig_title_tmpl.format(selected_ticker)\n",
"\n",
"# 2. register the callback by using the 'observe' method\n",
"dropdown.observe(update_plot, 'value')\n",
"\n",
"# stack the dropdown and fig widgets using VBox\n",
"VBox([dropdown, fig])"
"VBox([dropdown, fig2])"
]
},
{
Expand Down Expand Up @@ -201,7 +201,7 @@
"\n",
"# set up fig_margin to allow space to display color bar\n",
"fig_margin = dict(top=20, bottom=40, left=60, right=80)\n",
"fig = plt.figure(animation_duration=1000, fig_margin=fig_margin)\n",
"fig3 = plt.figure(animation_duration=1000, fig_margin=fig_margin)\n",
"\n",
"# custom axis options for color data\n",
"axes_options = {'color': {'tick_format': '%m/%y', \n",
Expand Down Expand Up @@ -237,7 +237,7 @@
"y_dropdown.observe(update_scatter, 'value')\n",
"\n",
"# stack the dropdown and fig widgets using VBox\n",
"VBox([HBox([x_dropdown, y_dropdown]), fig])"
"VBox([HBox([x_dropdown, y_dropdown]), fig3])"
]
}
],
Expand Down

0 comments on commit 128c0de

Please sign in to comment.