Plot a maps not working in Notebook

779
2
06-14-2021 02:43 AM
ALI_AZZOUHRI
New Contributor III

Hi everyone i'm trying to plot a map using Geopandas and Matplotlib but is not showing , How i can fix that?

0 Kudos
2 Replies
DrVSSKiran
Occasional Contributor II

Hi,

Do it these two settings in your notebook.

1. In Run do it Markdown as mention in below pic.

DrVSSKiran_0-1623674418281.png

 

2. All Output to be toggle.

DrVSSKiran_2-1623674536740.png

 

0 Kudos
jcarlson
MVP Esteemed Contributor

To simply show the map, all you need to do is

aus_poas.plot()

What your code is doing, however, is assigning the output of the plot function to the variable ax, but not actually calling that output to see it. If all you want is to see the plot, you can call that variable in its own cell.

If, however, you're trying to create a MatPlotLib figure with the map in it, there's a different way. Note in the GeoPandas documentation for the plot function the parameter ax. This parameter indicates that you want your plot assigned to MatPlotLib axes; you should already have one established.

Try something like this:

fig1, ax1 = plt.subplots(1, 1, figsize=(6,6))

aus_poas.plot(ax=ax1)

plt.show()

 

- Josh Carlson
Kendall County GIS
0 Kudos