Skip to content

Commit

Permalink
Merge 213cc22 into 1607a41
Browse files Browse the repository at this point in the history
  • Loading branch information
akacarlyann committed Apr 15, 2018
2 parents 1607a41 + 213cc22 commit 3e25e05
Show file tree
Hide file tree
Showing 10 changed files with 364 additions and 1,658 deletions.
36 changes: 36 additions & 0 deletions docs-markdown/utils.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,20 @@ Parameter | Description
--|--
breaks | List of float values


## create_numeric_stops
Convert a Python list of a data domain (such as `[0, 1, 5, 100, 10000]`) into a generic numeric ramp between a minimum and maximum value, as in for a heatmap, choropleth 3-D extrusions, etc.

### Params
**create_numeric_stops**(_breaks, min_value, max_value_)

Parameter | Description
--|--
breaks | List of float values
min_value | Minimum ramp value
max_value | Maximum ramp value


## create_color_stops
Convert a Python list of a data domain (such as `[0, 1, 5, 100, 10000]`) into color ramp stops. Color ramps can be from colorBrewer, or a custom list of color values.

Expand Down Expand Up @@ -181,3 +195,25 @@ match_color_stops = [
]
color = color_map('California', match_color_stops, default_color='grey)')
```


## height_map
Return a height value (in meters) interpolated from given height_stops; for use with vector-based visualizations using fill-extrusion layers.

### Params
**height_map**(_lookup, height_stops, default_height=10.0_)

Parameter | Description
--|--
lookup | value is numeric for interpolated heights or string for categorical height stops
height_stops | height ramp stops generated from `create_numeric_stops`, or custom list of numeric or categorical stops with paired heights
default_height | height, in meters, for display of 3-D extrusion on map

### Usage
```python
from mapboxgl.utils import create_numeric_stops, height_map

# interpolate height
height_stops = create_numeric_stops([0, 50, 100, 500, 1500], 0, 150000)
height = height_map(117, height_stops)
```
10 changes: 8 additions & 2 deletions docs-markdown/viz.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
The `MapViz` class is the parent class of the various `mapboxgl-jupyter` visualizations. You can use this class to set default values for all visualizations rather than calling them directly from the other visualization objects.

### Params
**MapViz**(_data, access_token=None, center=(0, 0), below_layer='', opacity=1, div_id='map', height='500px', style='mapbox://styles/mapbox/light-v9?optimize=true', width='100%', zoom=0, min_zoom=0, max_zoom=24_)
**MapViz**(_data, access_token=None, center=(0, 0), below_layer='', opacity=1, div_id='map', height='500px', style='mapbox://styles/mapbox/light-v9?optimize=true', width='100%', zoom=0, min_zoom=0, max_zoom=24, pitch=0, bearing=0_)

Parameter | Description
--|--
Expand All @@ -34,6 +34,8 @@ width | The CSS width of the HTML div id in % or pixels.
height | The CSS height of the HTML map div in % or pixels.
zoom | starting zoom level for map
opacity | opacity of map data layer
pitch | starting pitch (in degrees) for map
bearing | starting bearing (in degrees) for map

### Methods
**as_iframe**(_self, html_data_)
Expand Down Expand Up @@ -320,7 +322,7 @@ viz.show()
The `ChoroplethViz` object handles the creation of a choropleth map and inherits from the `MapViz` class. It applies a thematic map style to polygon features with color shading in proportion to the intensity of the data being displayed. Choropleth polygons can be initialized with geojson source or vector source styled using the data-join technique.

### Params
**ChoroplethViz**(_data, vector_url=None, vector_layer_name=None, vector_join_property=None, data_join_property=None, # vector only label_property=None, color_property=None, color_stops=None, color_default='grey', color_function_type='interpolate', line_color='white', line_stroke='solid', line_width=1, *args, **kwargs_)
**ChoroplethViz**(_data, vector_url=None, vector_layer_name=None, vector_join_property=None, data_join_property=None, # vector only label_property=None, color_property=None, color_stops=None, color_default='grey', color_function_type='interpolate', line_color='white', line_stroke='solid', line_width=1, height_property=None, height_stops=None, height_default=0.0, height_function_type='interpolate', *args, **kwargs_)

Parameter | Description | Example
--|--|--
Expand All @@ -337,6 +339,10 @@ color_function_type | property to determine type of expression used by Mapbox to
line_color | property to determine choropleth border line color | "#FFFFFF"
line_stroke | property to determine choropleth border line stroke (one of solid (-), dashed (--), dotted (:), dash dot (-.)) | "solid" or "-"
line_width | property to determine choropleth border line width | 1
height_property | feature property for determining polygon height in 3D extruded choropleth map | "density"
height_stops | property for determining 3D extrusion height | [[0, 0], [500, 50000], [1500, 150000]]
height_default | default height (in meters) for 3D extruded polygons on map | 1500.0
height_function_type | roperty to determine `type` used by Mapbox to assign height | "interpolate"

[View options](https://github.com/mapbox/mapboxgl-jupyter/blob/master/docs-markdown/viz.md#params)

Expand Down

0 comments on commit 3e25e05

Please sign in to comment.