Цель: рисование MultiPolygon (суша) и MultiLinestring (реки) на одном и том же рисунке. Окрашивая землю в белый цвет.
Проблема: кажется, что MultiLinestring отображается как MultiPolygon, построенный путем автоматического закрытия всех его Linestrings, чтобы сделать их многоугольниками.
Контроль: при окрашивании MultiPolygon в белый цвет не окрашивается то, что кажется многоугольником, состоящим из Linestrings из MultiLinestring.
Вот воспроизводимый код:
import matplotlib.pyplot as plt
import cartopy.crs as ccrs
import cartopy.io.shapereader as shpreader
from cartopy.feature import ShapelyFeature
# creates a map
map_projection = ccrs.PlateCarree(central_longitude=0.0, globe=None)
map_figure = plt.figure()
map_subplot = plt.axes(projection=map_projection)
# limits the display bounds of the map
map_subplot.set_extent((5.2, 31.4, 35, 54.3), crs=map_projection)
# adding land from a local shp (source : Natural Earth website)
# facecolor = white
landshpfilename = "Central Europe _ lands minus lakes.shp"
landshapereader = shpreader.Reader(landshpfilename)
landshape_feature = ShapelyFeature(landshapereader.geometries(), map_projection, facecolor='white',edgecolor='black')
map_subplot.add_feature(landshape_feature)
# adding large river from a local shp (source : Natural Earth website)
# edgecolor = blue
largeriversshpfilename = "Central Europe _ large rivers minus lakes.shp"
largeriversshapereader = shpreader.Reader(largeriversshpfilename)
largeriversshape_feature = ShapelyFeature(largeriversshapereader.geometries(), map_projection,edgecolor='blue')
map_subplot.add_feature(largeriversshape_feature)
# verifying the geom_type of the first objects in the shapefiles
# putting it as a title
land_geom_type_text = ' '.join(['lands geom_type :',next(landshape_feature.geometries()).geom_type])
river_geom_type_text = ' '.join(['rivers geom_type :',next(largeriversshape_feature.geometries()).geom_type])
map_figure.suptitle('\n'.join([land_geom_type_text,river_geom_type_text]))
plt.show()
Вот результат: отрисованная карта
Вопрос: Как это исправить?
plt.scatter
. - person gepcel   schedule 14.07.2018facecolor='none'
(обратите внимание, что это строка none, а не объект None - это matplotlib-ism...) - person pelson   schedule 24.07.2018