我正在尝试在 GeoPandas 上创建一个 Matplotlib 颜色栏。
import geopandas as gp
import pandas as pd
import matplotlib.pyplot as plt
#Import csv data
df = df.from_csv('data.csv')
#Convert Pandas DataFrame to GeoPandas DataFrame
g_df = g.GeoDataFrame(df)
#Plot
plt.figure(figsize=(15,15))
g_plot = g_df.plot(column='column_name',colormap='hot',alpha=0.08)
plt.colorbar(g_plot)
我收到以下错误:
AttributeError Traceback (most recent call last)
<ipython-input-55-5f33ecf73ac9> in <module>()
2 plt.figure(figsize=(15,15))
3 g_plot = g_df.plot(column = 'column_name', colormap='hot', alpha=0.08)
----> 4 plt.colorbar(g_plot)
...
AttributeError: 'AxesSubplot' object has no attribute 'autoscale_None'
我不知道如何让彩条工作。