-
Notifications
You must be signed in to change notification settings - Fork 25
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
Add mapbox density charts #316
Draft
haotran-avaiga
wants to merge
1
commit into
develop
Choose a base branch
from
doc/add-mapbox-desity-charts
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
## Mapbox density charts | ||
|
||
This type of chart creates maps where density can be displayed. | ||
|
||
|
||
### Basic Mapbox Density Chart - Air Quality Index | ||
|
||
In this example, we will visualize the air quality index at 3 locations on map. Bigger circle will have worse air quality. | ||
|
||
```py | ||
data = { | ||
"lon": [10, 20, 30], | ||
"lat": [15, 25, 35], | ||
"air_index": [7, 20, 10] | ||
} | ||
|
||
layout = { | ||
"mapbox": { | ||
"style": "open-street-map" | ||
} | ||
} | ||
``` | ||
!!! example "Page content" | ||
|
||
=== "Markdown" | ||
|
||
``` | ||
<|{data}|chart|lon=lon|lat=lat|z=air_index|type=densitymapbox|layout={layout}|> | ||
``` | ||
|
||
=== "HTML" | ||
|
||
```html | ||
<taipy:chart type="densitymapbox" lon="lon" lat="lat" z="air_index" layout="layout">{data}</taipy:chart> | ||
``` | ||
|
||
<figure> | ||
<img src="mapbox-air-index-dark.png" class="visible-dark" /> | ||
<img src="mapbox-air-index.png" class="visible-light" /> | ||
<figcaption>Air Quality Index</figcaption> | ||
</figure> | ||
|
||
### World Map with Earthquake Magnitude | ||
|
||
|
||
```py | ||
df = pandas.read_csv( | ||
'https://raw.githubusercontent.com/plotly/datasets/master/earthquakes-23k.csv') | ||
|
||
opts = { | ||
"coloraxis": 'coloraxis', | ||
"hoverinfo": 'skip', | ||
"radius": 5 | ||
} | ||
|
||
layout = { | ||
'mapbox': { | ||
'style': 'stamen-terrain' | ||
}, | ||
"coloraxis": { | ||
"colorscale": "Viridis" | ||
}, | ||
"title": { | ||
"text": "Earthquake Magnitude" | ||
} | ||
} | ||
``` | ||
!!! example "Page content" | ||
|
||
=== "Markdown" | ||
|
||
``` | ||
<|{df}|chart|type=densitymapbox|lat=Latitude|lon=Longitude|z=Magnitude|options={opts}|layout={layout}|> | ||
``` | ||
|
||
=== "HTML" | ||
|
||
```html | ||
<taipy:chart type="densitymapbox" lat="Latitude" lon="Longitude" z="Magnitude" options="opts" layout="layout">{df}</taipy:chart> | ||
``` | ||
|
||
<figure> | ||
<img src="mapbox-earthquake-magnitude-dark.png" class="visible-dark" /> | ||
<img src="mapbox-earthquake-magnitude.png" class="visible-light" /> | ||
<figcaption>World Map with Earthquake Magnitude</figcaption> | ||
</figure> | ||
|
||
Explanation of parameters and options relevant to Mapbox density charts can be found [here](https://plotly.com/javascript/reference/densitymapbox/). Full details for the Taipy Chart control can be found in the Chart Control section of the [Taipy GUI User Manual](https://docs.taipy.io/en/latest/manuals/gui/viselements/chart/) | ||
|
||
### Key parameters | ||
| Parameter | Value Options | Location | | ||
| --------------- | ------------------------- | ------------------ | | ||
| type | "densitymapbox" | Control definition | | ||
| lon | Column name for longitudes | Control definition | | ||
| lat | Column name for latitudes | Control definition | | ||
| z | Column name for density | Control definition | | ||
| mapbox | Dictionary of parameters for maps (style). [More details](https://plotly.com/javascript/mapbox-layers/) | Layout | | ||
| radius | int | Options | | ||
| coloraxis | Dictionary (colorscale) | Layout+Options | |
Binary file added
BIN
+459 KB
docs/manuals/gui/viselements/charts/mapbox-earthquake-magnitude-dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
move key parameters to the top below the chart description