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)