问题描述
我正在使用以下代码在geopandas数据框的matplotlib图上绘制其他坐标/点。但是,由于图像指示该点未与弧度重叠-应该如此,因为纬度和经度位于从普查中获取数据的地理位置之内。请告知。
from cenpy import products
import pandas as pd
import matplotlib.pyplot as plt
import geopandas
%matplotlib inline
tustin = products.ACS(2018).from_county('Orange County,CA',level='tract',variables=['B23025_005E','B23025_003E'])
tustin['pct_unemployed'] = tustin.B23025_005E / tustin.B23025_003E * 100
print(tustin.crs)
# additional data co-ordinate
lat = 3374569.5
lon = -11782886.0
df = pd.DataFrame(
{'Place': ['X'],'Latitude': [lat],'Longitude': [lon]})
gdf = geopandas.GeoDataFrame(
df,geometry=geopandas.points_from_xy(df.Longitude,df.Latitude))
# setting the same crs as the main geopandas dataframe
gdf.crs = {'init': 'epsg:3857'}
# plot the first dataframe 'tustin' as a choropleth
f,ax = plt.subplots(1,1,figsize=(20,20))
tustin.dropna(subset=['pct_unemployed'],axis=0).plot('pct_unemployed',ax=ax,cmap='plasma')
ax.set_facecolor('k')
gdf.plot(ax=ax,color='red')
#ax.plot(-13144890.450,3992372.350,"ro")
plt.show()
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)