2017-11-21 14 views
0

BokehとBasemapのdrawmapboundaryには同じ色がありますか?私は色「アクア」と水域(例えば、大洋)を充填したいBokehワールドマップと彩色用の水筒

from mpl_toolkits.basemap import Basemap 
import matplotlib.pyplot as plt 
# setup Lambert Conformal basemap. 
m = Basemap(width=12000000,height=9000000,projection='lcc', 
      resolution='c',lat_1=45.,lat_2=55,lat_0=50,lon_0=-107.) 
# draw coastlines. 
m.drawcoastlines() 
# draw a boundary around the map, fill the background. 
# this background will end up being the ocean color, since 
# the continents will be drawn on top. 
m.drawmapboundary(fill_color='aqua') 
# fill continents, set lake color same as ocean color. 
m.fillcontinents(color='coral',lake_color='aqua') 
plt.show() 

:最初の例hereを参照。私は白黒の世界地図を生成することができますが、海洋を具体的にどのように色付けするのですか?

hereの国のJSONファイルを使用していて、GeoJSONDataSourceをロードしています。

import bokeh.plotting as bkp 
import bokeh.models as bkm 

filename = "test.html" 
tools = "pan,wheel_zoom,box_zoom,reset,previewsave" 

with open("./countries.geo.json", "r") as f: 
    countries = bkm.GeoJSONDataSource(geojson=f.read()) 

p = bkp.figure(width=1000, height=600, tools=tools, title='World Countries', x_axis_label='Longitude', y_axis_label='Latitude') 
p.x_range = bkm.Range1d(start=-180, end=180) 
p.y_range = bkm.Range1d(start=-90, end=90) 
p.patches("xs", "ys", color="white", line_color="black", source=countries) 

bkp.output_file(filename) 
bkp.save(p, filename) 

答えて

1

drawmapboundaryが何であるかを見て分かります。ちょうど背景色を設定する必要があります。 :)

import bokeh.plotting as bkp 
import bokeh.models as bkm 

filename = "test.html" 
tools = "pan,wheel_zoom,box_zoom,reset,previewsave" 

with open("./countries.geo.json", "r") as f: 
    countries = bkm.GeoJSONDataSource(geojson=f.read()) 

p = bkp.figure(width=1000, height=600, tools=tools, title='World Countries', x_axis_label='Longitude', y_axis_label='Latitude') 
p.background_fill_color = "aqua" 
p.x_range = bkm.Range1d(start=-180, end=180) 
p.y_range = bkm.Range1d(start=-90, end=90) 
p.patches("xs", "ys", color="white", line_color="black", source=countries) 

bkp.output_file(filename) 
bkp.save(p, filename) 
関連する問題