shapely - Geopandas plot all features same color -


is there easy way plot features in geodataframe same color, rather default color map?

say have following geodataframe of linestrings:

>>> import geopandas gpd >>> shapely.geometry import linestring >>>  >>> gdf=gpd.geodataframe(geometry=[linestring([(1,2),(4,5)]),linestring([(6,3),(7,3)]),linestring([(6,2),(8,9)])]) >>> gdf                 geometry 0  linestring (1 2, 4 5) 1  linestring (6 3, 7 3) 2  linestring (6 2, 8 9) >>>  

how can use gdf.plot() have 3 linestrings show colored black?

since setting single color not yet implemented, can create own colormap 1 color.

from matplotlib.colors import listedcolormap     mycolor = listedcolormap('blue') 

for example lead to

import geopandas gpd shapely.geometry import linestring matplotlib.colors import listedcolormap      mycolor = listedcolormap('blue')         gdf=gpd.geodataframe(geometry=[linestring([(1,2),(4,5)]),linestring([(6,3),(7,3)]),linestring([(6,2),(8,9)])]) gdf.plot(colormap=mycolor) 

figure result

of course can use other matplotlib color.


Comments

Popular posts from this blog

html - Styling progress bar with inline style -

java - Oracle Sql developer error: could not install some modules -

How to use autoclose brackets in Jupyter notebook? -