I have a Pandas dataframe containing Latitude and Longitude data for an abundance of points, and I would like to clip them to a shapefile; ie: everything outside the boundaries of the shapefile is dropped.
Is there a way to achieve this within a Python package such as MatPlotLib?
I have searched on Google, but 'clipping' seems to refer to data being cut off by map legends/axis rather than what I'm describing.
This image displays what I'm after - I did this in ArcMap but need to automate the process. The grey points represent the entire dataframe, while red points are 'clipped' to the green shapefile below.
Here is the code I'm running to over-lay the points in case it is of any use:
f, ax = plt.subplots(1, figsize=(12, 12))
ax.plot(Easting,Northing, 'bo', markersize=5)
IMD.plot(column='imd_score', colormap='Blues', linewidth=0.1, axes=ax)
locs, labels = plt.xticks()
plt.setp(labels, rotation=90)
plt.axis('equal')