All Questions
19
questions
0
votes
0
answers
33
views
Inserting legend in a Matplotlib/Geopandas Map
I've created a incidence map for a city, but now i need to manipulate the legend ( decrease its size, put it bellow the map/graph, insert labels). i've used a json file to plot the territory. Here's ...
0
votes
1
answer
76
views
How can I plot multiple legends for multiple geopandas plot layers?
I want two show both legends for both of my plot layers but it shows only just one legend. How can I fix this?
import geopandas
from shapely.geometry import Point
from shapely.geometry import Polygon
...
-1
votes
1
answer
112
views
Cannot Rotate Legend Horizontally in GeoPandas
I am trying to plot California counties and color them by their FIPS code. The sample code from the GeoPandas website is:
chicago.plot(
column="POP2010",
legend=True,
...
1
vote
2
answers
288
views
How to create a single figure legend for GeoAxes subplots
I have looked at the many other questions on here to try and solve this but for whatever reason I cannot. Each solution seems to give me the same error, or returns nothing at all.
I have a list of six ...
0
votes
0
answers
47
views
How to plot two GeoDataFrames with one legend in Python
I have the following code:
import geopandas as gpd
import matplotlib.pyplot as plt
states_gdf = gpd.read_file('https://www2.census.gov/geo/tiger/GENZ2018/shp/cb_2018_us_state_5m.zip')
CO_gdf = ...
0
votes
1
answer
402
views
How to change the position of legend in a map?
I've been trying to plot a shapefile over a basemap. My issue here is the placement of the legend. I wanted it to be placed outside (next to) the map.
Specifically, I am plotting the "Ecoregion&...
4
votes
3
answers
4k
views
Customize legend labels in Geopandas
I would like to customize the labels on the geopandas plot legend.
fig, ax = plt.subplots(figsize = (8,5))
gdf.plot(column = "WF_CEREAL", ax = ax, legend=True, categorical=True, cmap='...
0
votes
1
answer
1k
views
How can I add a legend while plotting multiple geopandas dataframes in the same subplot?
I have a geopandas dataframe world which I created using:
import geopandas as gpd
world = gpd.read_file(gpd.datasets.get_path('naturalearth_lowres'))
I created two different geodataframes for usa ...
0
votes
2
answers
516
views
Geopandas legend not showing bins for which there are zero observations in dataset
I'm trying to classify the number of bird species found in US states. The values fall between 250 and 750, so I'm dividing them up into 10 bins of 50 (using MapClassify's UserDefined classifier). Here'...
0
votes
1
answer
764
views
How to make a legend with matplotlib plotting a map?
I have the following plot:
Inside this map you see some random coloured areas with numbers in it. The numbers are 12,25,34,38 and 43. Now I want to add a legend in the above left corner with the ...
3
votes
0
answers
180
views
How do I change de size of the legend with matplotlib? and identify the states on my map
I have made this code for an activity, I am a beginner in python. But when I plot, the legend only shows the first letter of my legend. Also, this map shows a group of states and I would like to know ...
1
vote
1
answer
3k
views
Adding custom names to a GeoPandas legend
I have a shapefile which has an attribute table with a column I would like to make a map/plot of. The attribute values are numerical (integer). I have made two dicts to map the colors and names I want ...
3
votes
1
answer
1k
views
Suppress scientific notation in geopandas plot legend [duplicate]
I am new to geopandas and am trying to plot a map with a legend in regular notation not scientific notation. I understand I must use the legend_kwds and know about the 'fmt' keyword but I've tried ...
2
votes
2
answers
5k
views
Adding legend in geopandas plot with subplots changes size of plot
I want to plot two GeoPandas plots with matplotlib subplots. The two maps have the same legend, and therefore I only want to have one legend. However, if I add a legend to one of the GeoPandas plots, ...
3
votes
1
answer
2k
views
Error `No handles with labels` when trying to relocate geopandas legend
My plot works fine as long as I do not attempt to change the location of its legend. (I am plotting a GeoDataFrame.)
# %%
ax = NE_shp.plot(column=NE_shp.iloc[:,4], figsize=(10,3), scheme='quantiles', ...