Sto provando a creare una barra colori Matplotlib su GeoPandas.Colorbar on Geopandas
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)
ottengo il seguente errore:
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'
io non sono sicuro di come ottenere colorbar al lavoro.
GeoDataFrame restituisce un oggetto 'Axes' matplotlib. 'plt.colorbar' richiede un oggetto mappabile (un' Axes' non è un oggetto mappabile). – tom