earthpy icon indicating copy to clipboard operation
earthpy copied to clipboard

Colorbar only works for raster plots

Open lwasser opened this issue 4 years ago • 0 comments

It's trying to run get_array on the figure but that doesn't return anything because it's a vector plot. ...

import earthpy.plot as ep
country_data_url = "https://www.naturalearthdata.com/http//www.naturalearthdata.com/download/50m/cultural/ne_50m_admin_0_countries.zip"
et.data.get_data(url=country_data_url)

# Create a path to the countries shapefile
countries_path = os.path.join("data", "earthpy-downloads",
                              "ne_10m_admin_0_countries", 
                              "ne_10m_admin_0_countries.shp")


gpd.read_file(countries_path)
# Create a path to the countries shapefile
countries_path = os.path.join("data", "earthpy-downloads",
                              "ne_10m_admin_0_countries", 
                              "ne_10m_admin_0_countries.shp")
f, ax1 = plt.subplots(figsize=(10,6))
im = countries.plot(column='POP_EST',
              ax=ax1)
ep.colorbar(im)
plt.show()

lwasser avatar Jun 09 '20 18:06 lwasser