-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
remove go.layout.shape from the tutorial #2104
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
Changes from all commits
b67b171
34dd304
c8d7058
6d351b6
b326086
8393d87
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
pk.eyJ1IjoiZXRwaW5hcmQiLCJhIjoiY2luMHIzdHE0MGFxNXVubTRxczZ2YmUxaCJ9.hwWZful0U2CQxit4ItNsiQ | ||
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,8 +5,8 @@ jupyter: | |
text_representation: | ||
extension: .md | ||
format_name: markdown | ||
format_version: "1.1" | ||
jupytext_version: 1.1.1 | ||
format_version: '1.1' | ||
jupytext_version: 1.2.1 | ||
kernelspec: | ||
display_name: Python 3 | ||
language: python | ||
|
@@ -20,7 +20,7 @@ jupyter: | |
name: python | ||
nbconvert_exporter: python | ||
pygments_lexer: ipython3 | ||
version: 3.6.7 | ||
version: 3.7.3 | ||
plotly: | ||
description: How to make bubble maps in Python with Plotly. | ||
display_as: maps | ||
|
@@ -78,7 +78,6 @@ See https://plot.ly/python/reference/#scatter-marker-sizeref for more informatio | |
|
||
```python | ||
import plotly.graph_objects as go | ||
|
||
import pandas as pd | ||
|
||
df = pd.read_csv('https://raw.githubusercontent.com/plotly/datasets/master/2014_us_cities.csv') | ||
|
@@ -96,27 +95,22 @@ for i in range(len(limits)): | |
lim = limits[i] | ||
df_sub = df[lim[0]:lim[1]] | ||
fig.add_trace(go.Scattergeo( | ||
locationmode = 'USA-states', | ||
lon = df_sub['lon'], | ||
lat = df_sub['lat'], | ||
text = df_sub['text'], | ||
marker = dict( | ||
size = df_sub['pop']/scale, | ||
color = colors[i], | ||
locationmode='USA-states', | ||
lon=df_sub['lon'], | ||
lat=df_sub['lat'], | ||
text=df_sub['text'], | ||
marker=dict( | ||
size=df_sub['pop']/scale, | ||
color=colors[i], | ||
line_color='rgb(40,40,40)', | ||
line_width=0.5, | ||
sizemode = 'area' | ||
), | ||
name = '{0} - {1}'.format(lim[0],lim[1]))) | ||
sizemode='area'), | ||
name='{0} - {1}'.format(lim[0],lim[1]))) | ||
|
||
fig.update_layout( | ||
title_text = '2014 US city populations<br>(Click legend to toggle traces)', | ||
showlegend = True, | ||
geo = dict( | ||
scope = 'usa', | ||
landcolor = 'rgb(217, 217, 217)', | ||
) | ||
) | ||
title_text='2014 US city populations<br>(Click legend to toggle traces)', | ||
showlegend=True, | ||
geo=dict(scope='usa', landcolor='rgb(217, 217, 217)')) | ||
|
||
fig.show() | ||
``` | ||
|
@@ -125,7 +119,6 @@ fig.show() | |
|
||
```python | ||
import plotly.graph_objects as go | ||
|
||
import pandas as pd | ||
|
||
df = pd.read_csv('https://raw.githubusercontent.com/plotly/datasets/master/2014_ebola.csv') | ||
|
@@ -146,8 +139,7 @@ for i in range(6,10)[::-1]: | |
marker = dict( | ||
size = df_month['Value']/50, | ||
color = colors[i-6], | ||
line_width = 0 | ||
))) | ||
line_width = 0))) | ||
|
||
df_sept = df.query('Month == 9') | ||
fig['data'][0].update(mode='markers+text', textposition='bottom center', | ||
|
@@ -156,52 +148,42 @@ fig['data'][0].update(mode='markers+text', textposition='bottom center', | |
|
||
# Inset | ||
fig.add_trace(go.Choropleth( | ||
locationmode = 'country names', | ||
locations = df_sept['Country'], | ||
z = df_sept['Value'], | ||
text = df_sept['Country'], | ||
colorscale = [[0,'rgb(0, 0, 0)'],[1,'rgb(0, 0, 0)']], | ||
autocolorscale = False, | ||
showscale = False, | ||
geo = 'geo2' | ||
)) | ||
fig.add_trace(go.Scattergeo( | ||
lon = [21.0936], | ||
lat = [7.1881], | ||
text = ['Africa'], | ||
mode = 'text', | ||
showlegend = False, | ||
geo = 'geo2' | ||
)) | ||
|
||
locationmode='country names', | ||
locations=df_sept['Country'], | ||
z=df_sept['Value'], | ||
text=df_sept['Country'], | ||
colorscale=[[0,'rgb(0, 0, 0)'],[1,'rgb(0, 0, 0)']], | ||
autocolorscale=False, | ||
showscale=False, | ||
geo='geo2')) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. all these trailing parentheses should go back to being on their own line please There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I was hoping that this PR would be a simple "remove all There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok, to make it less painful I created #2171 for removal of go.layout.* and will take care of formatting later |
||
|
||
fig.add_trace(go.Scattergeo(lon=[21.0936], lat=[7.1881], text=['Africa'], mode='text', | ||
showlegend=False, geo='geo2')) | ||
fig.update_layout( | ||
title = go.layout.Title( | ||
text = 'Ebola cases reported by month in West Africa 2014<br> \ | ||
title = dict( | ||
text='Ebola cases reported by month in West Africa 2014<br> \ | ||
Source: <a href="https://data.hdx.rwlabs.org/dataset/rowca-ebola-cases">\ | ||
HDX</a>'), | ||
geo = go.layout.Geo( | ||
resolution = 50, | ||
scope = 'africa', | ||
showframe = False, | ||
showcoastlines = True, | ||
landcolor = "rgb(229, 229, 229)", | ||
countrycolor = "white" , | ||
coastlinecolor = "white", | ||
projection_type = 'mercator', | ||
lonaxis_range= [ -15.0, -5.0 ], | ||
lataxis_range= [ 0.0, 12.0 ], | ||
domain = dict(x = [ 0, 1 ], y = [ 0, 1 ]) | ||
), | ||
geo2 = go.layout.Geo( | ||
scope = 'africa', | ||
showframe = False, | ||
landcolor = "rgb(229, 229, 229)", | ||
showcountries = False, | ||
domain = dict(x = [ 0, 0.6 ], y = [ 0, 0.6 ]), | ||
bgcolor = 'rgba(255, 255, 255, 0.0)', | ||
), | ||
legend_traceorder = 'reversed' | ||
) | ||
geo = dict( | ||
resolution=50, | ||
scope='africa', | ||
showframe=False, | ||
showcoastlines=True, | ||
landcolor="rgb(229, 229, 229)", | ||
countrycolor="white" , | ||
coastlinecolor="white", | ||
projection_type='mercator', | ||
lonaxis_range=[ -15.0, -5.0 ], | ||
lataxis_range=[ 0.0, 12.0 ], | ||
domain = dict(x=[ 0, 1 ], y=[ 0, 1 ])), | ||
geo2 = dict( | ||
scope='africa', | ||
showframe=False, | ||
landcolor="rgb(229, 229, 229)", | ||
showcountries=False, | ||
domain=dict(x=[ 0, 0.6 ], y=[ 0, 0.6 ]), | ||
bgcolor='rgba(255, 255, 255, 0.0)'), | ||
legend_traceorder='reversed') | ||
|
||
fig.show() | ||
``` | ||
|
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.
delete this file plz
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.
.gitignore didn't ignore it! "git rm --cached .mapbox_token" removes it from repo.
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.
OK but it's still here... you'll have to remove it again and push again :)