Skip to content

Commit

Permalink
Add color utility, update examples, standardize name
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrew Duberstein committed Jun 17, 2019
1 parent ae44776 commit bc7ceef
Show file tree
Hide file tree
Showing 10 changed files with 771 additions and 223 deletions.
10 changes: 5 additions & 5 deletions bindings/python/pydeck/README.md
@@ -1,15 +1,15 @@
# PyDeck: Beautiful maps with Python
# pydeck: Beautiful maps with Python

![demo](https://user-images.githubusercontent.com/2204757/58838976-1538f400-8615-11e9-84f6-a2fe42bb300b.gif)

yDeck is a set of Python bindings for making spatial visualizations with [deck.gl](https://deck.gl),
pydeck is a set of Python bindings for making spatial visualizations with [deck.gl](https://deck.gl),
optimized for a Jupyter Notebook environment.

For more, open the `examples/` directory in a Jupyter notebook.

## Getting started

First, install PyDeck:
First, install pydeck:

```bash
pip install pydeck
Expand All @@ -29,7 +29,7 @@ pip install pydeck
# Clone the deck.gl repo
git clone https://github.com/uber/deck.gl/

# Navigate to the PyDeck module
# Navigate to the pydeck module
cd deck.gl/bindings/python/pydeck

# Create a virtual environment
Expand All @@ -41,7 +41,7 @@ python setup.py install

## Development

Install PyDeck from its source as above.
Install pydeck from its source as above.

To install the Jupyter extension in [JupyterLab](https://jupyterlab.readthedocs.io/en/stable/), you can run:

Expand Down
30 changes: 15 additions & 15 deletions bindings/python/pydeck/examples/01 - Introduction.ipynb
Expand Up @@ -4,24 +4,24 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"# A Brief Intro to PyDeck\n",
"# A Brief Intro to pydeck\n",
"\n",
"PyDeck is made for visualizing data points in 2D or 3D maps. Specifically, it handles\n",
"pydeck is made for visualizing data points in 2D or 3D maps. Specifically, it handles\n",
"\n",
"- rendering large (>1M points) data sets, like LIDAR point clouds or GPS pings\n",
"- large-scale updates to data points, like plotting points with motion\n",
"- making beautiful maps\n",
"\n",
"Under the hood, it's powered by the [deck.gl](https://github.com/uber/deck.gl/) JavaScript framework.\n",
"\n",
"PyDeck is strongest when used in tandem with [Pandas](https://pandas.pydata.org/) but doesn't have to be.\n",
"pydeck is strongest when used in tandem with [Pandas](https://pandas.pydata.org/) but doesn't have to be.\n",
"\n",
"Please note that **these demo notebooks are best when executed cell-by-cell**, so ideally clone this repo."
]
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -32,9 +32,9 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"# There are three steps for most PyDeck visualizations\n",
"# There are three steps for most pydeck visualizations\n",
"\n",
"We'll walk through PyDeck using a visualization of vehicle accident data in the United Kingdom.\n",
"We'll walk through pydeck using a visualization of vehicle accident data in the United Kingdom.\n",
"\n",
"## 1. Choose your data\n",
"\n",
Expand All @@ -43,7 +43,7 @@
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": 2,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -110,7 +110,7 @@
"4 -0.206022 51.496572"
]
},
"execution_count": 6,
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -129,7 +129,7 @@
"source": [
"## 2. Configure the visualization: Choose your layer(s) and viewport\n",
"\n",
"PyDeck's **`Layer`** object takes two positional and many keyword arguments:\n",
"pydeck's **`Layer`** object takes two positional and many keyword arguments:\n",
"\n",
"- First, a string specifying the layer type, with our example below using `'HexagonLayer'`\n",
"- Next, a data URL–below you'll see the `UK_ACCIDENTS_DATA` that we set above, but we could alternately pass a data frame or list of dictionaries\n",
Expand All @@ -153,18 +153,18 @@
"\n",
"The **`ViewState`** object specifies a camera angle relative to the map data. If you don't want to manually specify it, the function **`pydeck.data_utils.autocompute_viewport`** can take your data and automatically zoom to it.\n",
"\n",
"PyDeck also provides some controls, most of which should be familiar from map applications throughout the web. By default, you can hold out and drag to rotate the map."
"pydeck also provides some controls, most of which should be familiar from map applications throughout the web. By default, you can hold out and drag to rotate the map."
]
},
{
"cell_type": "code",
"execution_count": 7,
"execution_count": 3,
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "314e74bf489843dcaab9abaf93c261da",
"model_id": "a479181804a04755a33d8382f7068f3b",
"version_major": 2,
"version_minor": 0
},
Expand Down Expand Up @@ -211,11 +211,11 @@
},
{
"cell_type": "code",
"execution_count": 16,
"execution_count": 5,
"metadata": {},
"outputs": [],
"source": [
"layer.elevation_range = [0, 2000]\n",
"layer.elevation_range = [0, 5000]\n",
"r.update()"
]
},
Expand All @@ -230,7 +230,7 @@
},
{
"cell_type": "code",
"execution_count": 22,
"execution_count": 7,
"metadata": {},
"outputs": [],
"source": [
Expand Down
14 changes: 7 additions & 7 deletions bindings/python/pydeck/examples/02 - Scatterplots.ipynb
Expand Up @@ -4,7 +4,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"# Scatterplots in PyDeck: A case study using Beijing subway stops\n",
"# Scatterplots in pydeck: A case study using Beijing subway stops\n",
"\n",
"*(About 5-10 minutes to read)*\n",
"\n",
Expand All @@ -16,7 +16,7 @@
"\n",
"- [Getting the data](#Getting-the-data)\n",
"- [Data cleaning](#Data-cleaning)\n",
"- [Using PyDeck to automatically create a viewport](#Automatically-generate-a-viewport)\n",
"- [Using pydeck to automatically create a viewport](#Automatically-generate-a-viewport)\n",
"- [Plotting the data](#Plotting-the-data)\n",
"- [Plotting the data over time](#Playing-the-data-forward-in-time)"
]
Expand Down Expand Up @@ -193,7 +193,7 @@
"source": [
"## Automatically generate a viewport\n",
"\n",
"PyDeck features some nifty utilities for visualizing data, like an **automatic zoom using `data_utils.autocompute_viewport`** for 2D data sets.\n",
"pydeck features some nifty utilities for visualizing data, like an **automatic zoom using `data_utils.autocompute_viewport`** for 2D data sets.\n",
"\n",
"We'll render the viewport, as well, just to verify that the visualization looks sensible."
]
Expand All @@ -206,7 +206,7 @@
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "305cefd9a98440d5b7f4a5dfc28cda4c",
"model_id": "0068b764a2364d06b38f943e7c6deb91",
"version_major": 2,
"version_minor": 0
},
Expand Down Expand Up @@ -250,7 +250,7 @@
"\n",
"**We can specify the layer type as the first argument, the data as the second, and the layer arguments as keywords.** **[`ScatterplotLayer`](https://github.com/uber/deck.gl/blob/master/docs/layers/scatterplot-layer.md)** is one of a list of layers available in the deck.gl core library. We'll also provide a header to list the year using some built-in Jupyter notebook tools.\n",
"\n",
"As aside, for a list of other layers, see the [deck.gl documentation](https://github.com/uber/deck.gl/tree/master/docs/layers#deckgl-layer-catalog-overview). Remember that deck.gl is a JavaScript library and not a Python one, so the documentation may differ for some kinds of terminology and functionality (e.g., PyDeck doesn't support passing functions as arguments but this is a common occurrence within deck.gl)."
"As aside, for a list of other layers, see the [deck.gl documentation](https://github.com/uber/deck.gl/tree/master/docs/layers#deckgl-layer-catalog-overview). Remember that deck.gl is a JavaScript library and not a Python one, so the documentation may differ for some kinds of terminology and functionality (e.g., pydeck doesn't support passing functions as arguments but this is a common occurrence within deck.gl)."
]
},
{
Expand All @@ -263,7 +263,7 @@
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "23f129dc0e8c4b81b889b42068063404",
"model_id": "ad1d271e7eaf47c4929e7bb15fb9dbde",
"version_major": 2,
"version_minor": 0
},
Expand All @@ -277,7 +277,7 @@
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "d223368495174ea389e9ddd1c0d6facc",
"model_id": "a7d26db5d9ac464a97170acc3676246f",
"version_major": 2,
"version_minor": 0
},
Expand Down

0 comments on commit bc7ceef

Please sign in to comment.