0

I'm using GeoPandas to create a categorical choropleth of my data. I managed to get the correct colormap applied to the polygon fill but there are tiny slivers between the polygons that I would like to remove. What is the appropriate way to do this? I thought about the following options:

  1. Apply the same color (same as used for fill) to each polygon line
  2. Make the lines transparent
  3. Set the line width to 0

This is my code so far:

fig, ax = plt.subplots()
ax.set_xlim(xmin, xmax)
ax.set_ylim(ymin , ymax)
gdf.plot(ax=ax,column=column,cmap=cmap,categorical=True,linewidth=0)
plt.axis('off')
fig.savefig(output_filename+".pdf",dpi=300)
fig.savefig(output_filename+".jpg",dpi=300)

Gdf is a geodataframe with multiPolygons. The result looks like this. As you can see, there are weird slivers between the polygons. The shapefile does not contain any gaps.

enter image description here

  • Do you mean white lines within the colored areas? – Kadir Şahbaz Jul 25 at 12:59
  • Yes, adjacent polygons sometimes have the same color. Ideally I would only view the polygon fill, no outlines whatsoever. – RutgerH Jul 25 at 13:43
  • I found a way around the issue by splitting up the the data and plotting each category as a separate layer. – RutgerH Jul 25 at 15:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.