我正在尝试在绘图中添加MarkerEdge颜色(marker='.',我希望标记根据其特征被不同的颜色包围)
我试图用地理数据这样做:https://python-graph-gallery.com/131-custom-a-matplotlib-scatterplot/
fig, ax = plt.subplots(figsize = (8,6))
df.plot(ax=ax,color='green', marker=".", markersize=250)
df2.plot(ax=ax,color='green', marker=".", markerfacecolor="orange", markersize=250)
但是我得到了这个错误:
AttributeError: 'PathCollection' object has no property 'markeredgecolor'
你知道有什么问题吗?怎么办
编辑-使用可复制的示例:
#Packages needed
import pandas as pd
import matplotlib.pyplot as plt
import geopandas as gpd
import shapely.wkt
#Creating GeoDataFrame df2
df2 = pd.DataFrame([shapely.wkt.loads('POINT (7.23173 43.68249)'),shapely.wkt.loads('POINT (7.23091 43.68147)')])
df2.columns=['geometry']
df2 = gpd.GeoDataFrame(df2)
df2.crs = {'init' :'epsg:4326'}
#Ploting df2
fig, ax = plt.subplots()
df2.plot(ax=ax,color='green', marker=".", markerfacecolor="orange")
Geopandas
plot
不接受所有参数作为matplotlib.plot(引用[此处])(https://geopandas.readthedocs.io/en/latest/docs/reference/api/geopandas.GeoDataFrame.plot.html)但是,有一些
**style_kwds
可以为您完成这项工作(尽管文档中没有明确说明):收回你的代码
在
requirements.txt
中具有此配置相关问题 更多 >
编程相关推荐