How to plot Shapefile in Python | Part-03

preview_player
Показать описание
In this video a detailed explain about how a shapefile can be plotted in python is discussed. The main focus of the video is to be able to plot the shapefile with data like area of each portion of the shapefile and plot it with different colors for better understanding. Along with that it is also discussed how a base map can be added to the background of the plotted shapefile along with the details like north arrow, scalebar, legend and also make the shapefile transparent.

code used:
import geopandas as gpd
import contextily as ctx

def numft(x,pos):
s =f'{x/1000:,.0f}'
return s

z_pal =[0,5910,6310,7740,12170]
pal_rgb = ['aqua','purple','brown', 'red']
cmap2,norm =from_levels_and_colors(z_pal,pal_rgb,extend= 'neither')

# Create a Patch object with the desired properties
catalunya_line = mlines.Line2D([], [], color='black', label='Catalunya provinces')

# catalunya_patch = mpatches.Patch(color='black', label='Catalunya provinces')

formatter = tik.FuncFormatter(numft)
# Add the north arrow
x, y, arrow_length = 0.95, 1, 0.09
arrowprops=dict(facecolor='black', width=5, headwidth=15),
ha='center', va='center', fontsize=26,
scalebar = ScaleBar(0.001, units='km', location='lower center')

divider = make_axes_locatable(ax)

Рекомендации по теме
Комментарии
Автор

any special need or advantage of plotting the shape file using python? when GIS softwares are there

rathnakumarv
welcome to shbcf.ru