Skip to content

Clean up taxi example #4

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 42 additions & 15 deletions notebooks/00-welcome.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -25,28 +25,28 @@
"source": [
"## Index and Schedule\n",
"\n",
"This 3.5-hour tutorial is broken down into the following sections. Sections marked \"*(Omit)*\" are available for later self study, but there is not expected to be time to present those in detail.\n",
"This 4-hour tutorial is broken down into the following sections. To fit the allotted time, some sections may be omitted or presented only as overviews, but these will be available for later self study.\n",
"\n",
"- *Overview*\n",
"\n",
" *   **5 min**  [0 - Welcome](./00-welcome.ipynb): (This notebook!) Welcome, demos, and setup.\n",
" * **20 min** &nbsp;[1 - Workflow](./01-workflow-introduction.ipynb): Overview of solving a simple but complete data-science task from exploration to deployment.<br><br>\n",
" * **15 min** &nbsp;[0 - Welcome](./00-welcome.ipynb): (This notebook!) Welcome, demos, and setup.\n",
" * **35 min** &nbsp;[1 - Workflow](./01-workflow-introduction.ipynb): Overview of solving a simple but complete data-science task from exploration to deployment.<br><br>\n",
"\n",
"- *Making data visualizable*\n",
" * **30 min** &nbsp;[2 - Annotating your data](./02-annotating-data.ipynb): Using HoloViews Elements to make your data instantly visualizable\n",
" * **35 min** &nbsp;[2 - Annotating your data](./02-annotating-data.ipynb): Using HoloViews Elements to make your data instantly visualizable\n",
" * **20 min** &nbsp;[3 - Customizing visual appearance](./03-customizing-visual-appearance.ipynb): How to change the appearance and output format of elements.\n",
" * **20 min** &nbsp;[4 - Exploration with containers](./04-exploration-with-containers.ipynb): Using HoloViews \"containers\" for quick, easy data exploration.\n",
" * **25 min** &nbsp;[4 - Exploration with containers](./04-exploration-with-containers.ipynb): Using HoloViews \"containers\" for quick, easy data exploration.\n",
" * *(Omit)* &nbsp;&nbsp;&nbsp;[5 - Working with tabular data](./05-working-with-tabular-data.ipynb): Exploring a tabular (columnar) dataset.\n",
" * *(Omit)* &nbsp;&nbsp;&nbsp;[6 - Working with gridded data](./06-working-with-gridded-data.ipynb): Exploring a gridded (n-dimensional) dataset.\n",
" * **30 min** &nbsp;*Break*\n",
"\n",
"\n",
"- *Interactive apps and dashboards*\n",
"\n",
" * **25 min** &nbsp;[7 - Custom interactivity](./07-custom-interactivity.ipynb): Using HoloViews \"streams\" to add interactivity to your visualizations.\n",
" * **30 min** &nbsp;[7 - Custom interactivity](./07-custom-interactivity.ipynb): Using HoloViews \"streams\" to add interactivity to your visualizations.\n",
" * **15 min** &nbsp;[8 - Operations and pipelines](./08-operations-and-pipelines.ipynb): Dynamically transforming your data as needed\n",
" * *(Omit)* &nbsp;&nbsp;&nbsp;[9 - Working with large data](./09-working-with-large-datasets.ipynb): Using datasets too large to feed directly to your browser.\n",
" * **15 min** &nbsp;[10 - Parameters and widgets](./10-parameters-and-widgets.ipynb): Declarative custom controls\n",
" * **05 min** &nbsp;[10 - Parameters and widgets](./10-parameters-and-widgets.ipynb): Declarative custom controls\n",
" * **30 min** &nbsp;[11 - Deploying Bokeh Apps](./11-deploying-bokeh-apps.ipynb): Deploying your visualizations using Bokeh server."
]
},
Expand Down Expand Up @@ -124,7 +124,9 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"from IPython.core import page\n",
Expand Down Expand Up @@ -160,7 +162,9 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"import holoviews as hv\n",
Expand All @@ -177,7 +181,9 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"hv.extension('bokeh', 'matplotlib')"
Expand All @@ -193,7 +199,9 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"import bokeh\n",
Expand All @@ -214,7 +222,9 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"import os\n",
Expand All @@ -239,7 +249,9 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"lines = \"\"\"\\\n",
Expand All @@ -259,7 +271,9 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"rcpath = os.path.join(os.path.expanduser('~'), '.holoviews.rc')\n",
Expand All @@ -270,9 +284,22 @@
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"pygments_lexer": "ipython3"
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.2"
}
},
"nbformat": 4,
Expand Down
22 changes: 10 additions & 12 deletions notebooks/01-workflow-introduction.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"metadata": {},
"outputs": [],
"source": [
"import holoviews as hv\n",
Expand Down Expand Up @@ -406,13 +404,13 @@
"class NYCTaxiExplorer(hv.streams.Stream):\n",
" alpha = param.Magnitude(default=0.75, doc=\"Alpha value for the map opacity\")\n",
" colormap = param.ObjectSelector(default=cm[\"fire\"], objects=cm.values())\n",
" plot = param.ObjectSelector(default=\"pickup\", objects=[\"pickup\",\"dropoff\"])\n",
" location = param.ObjectSelector(default=\"pickup\", objects=[\"pickup\",\"dropoff\"])\n",
" passengers = param.Range(default=(0, 10), bounds=(0, 10))\n",
"\n",
" def make_view(self, x_range=None, y_range=None, **kwargs):\n",
" map_tiles = tiles.opts(style=dict(alpha=self.alpha), plot=options) \n",
"\n",
" points = hv.Points(df, kdims=[self.plot+'_x', self.plot+'_y'], vdims=['passenger_count'])\n",
" points = hv.Points(df, kdims=[self.location+'_x', self.location+'_y'], vdims=['passenger_count'])\n",
" selected = points.select(passenger_count=self.passengers)\n",
" taxi_trips = datashade(selected, x_sampling=1, y_sampling=1, cmap=self.colormap,\n",
" dynamic=False, x_range=x_range, y_range=y_range,\n",
Expand All @@ -433,7 +431,7 @@
"metadata": {},
"outputs": [],
"source": [
"explorer = NYCTaxiExplorer(alpha=0.2, plot=\"dropoff\")\n",
"explorer = NYCTaxiExplorer(alpha=0.2, location=\"dropoff\")\n",
"explorer.make_view()"
]
},
Expand All @@ -452,7 +450,7 @@
"metadata": {},
"outputs": [],
"source": [
"explorer = NYCTaxiExplorer()\n",
"explorer = NYCTaxiExplorer(name=\"NYC Taxi Trips\")\n",
"paramnb.Widgets(explorer, callback=explorer.event)\n",
"hv.DynamicMap(explorer.make_view, streams=[explorer, RangeXY()])"
]
Expand All @@ -463,7 +461,7 @@
"metadata": {},
"outputs": [],
"source": [
"explorer = NYCTaxiExplorer()\n",
"explorer = NYCTaxiExplorer(name=\"NYC Taxi Trips\")\n",
"parambokeh.Widgets(explorer, callback=explorer.event)\n",
"hv.DynamicMap(explorer.make_view, streams=[explorer, RangeXY()])"
]
Expand Down Expand Up @@ -519,11 +517,11 @@
"class NYCTaxiExplorer(hv.streams.Stream):\n",
" alpha = param.Magnitude(default=0.75, doc=\"Alpha value for the map opacity\")\n",
" colormap = param.ObjectSelector(default=cm[\"fire\"], objects=[cm[k] for k in cm.keys() if not '_' in k])\n",
" plot = param.ObjectSelector(default=\"pickup\", objects=[\"pickup\",\"dropoff\"])\n",
" location = param.ObjectSelector(default=\"pickup\", objects=[\"pickup\",\"dropoff\"])\n",
" passengers = param.Range(default=passenger_counts, bounds=passenger_counts)\n",
" output = parambokeh.view.Plot()\n",
"\n",
" def make_view(self, x_range, y_range, alpha, colormap, plot, passengers, **kwargs):\n",
" def make_view(self, x_range, y_range, alpha, colormap, location, passengers, **kwargs):\n",
" map_tiles = tiles(style=dict(alpha=alpha), plot=tile_options)\n",
" points = hv.Points(df, kdims=[plot+'_x', plot+'_y'], vdims=['passenger_count'])\n",
" if passengers != passenger_counts: points = points.select(passenger_count=passengers)\n",
Expand Down Expand Up @@ -567,9 +565,9 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"display_name": "Python [conda env:hvtutorial]",
"language": "python",
"name": "python3"
"name": "conda-env-hvtutorial-py"
},
"language_info": {
"codemirror_mode": {
Expand Down
Loading