question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Maps with Layers tutorial doesn't work

See original GitHub issue

Whenever I specify ax=anything, a blank map is output.

python 3.6.4 matplotlib 2.1.2 geopandas 0.3.0

%matplotlib inline
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import geopandas as gpd

world = gpd.read_file(gpd.datasets.get_path('naturalearth_lowres'))
cities = gpd.read_file(gpd.datasets.get_path('naturalearth_cities'))
cities = cities.to_crs(world.crs)

fig, ax = plt.subplots()
# displays blank axes
ax.set_aspect('equal')
world.plot(ax=ax, color='white', edgecolor='black')
# <matplotlib.axes._subplots.AxesSubplot at 0x7fe0dd4500b8>
# <matplotlib.figure.Figure at 0x7fe0dd3f8710>

cities.plot(ax=ax, marker='o', color='red', markersize=5)
# <matplotlib.axes._subplots.AxesSubplot at 0x7fe0dd4500b8>
# <matplotlib.figure.Figure at 0x7fe104448ef0>

plt.show() # nothing
plt.savefig("test2.png") # file is a white rectangle

plotting any of these independently displays the expected output

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
jorisvandenbosschecommented, Jul 14, 2018

Closing this as I don’t think there is anything to do on the geopandas side. But please further comment if you still have problems with this!

0reactions
taimur38commented, Mar 16, 2018

@jorisvandenbossche with fig.savefig() I do manage to get the correct figure saved as a png, thank you.

but I still can’t get anything to show inline

Read more comments on GitHub >

github_iconTop Results From Across the Web

[ ‍♀️#1] HELP! My Map Doesn't Work ... - YouTube
But not just the flag of the USA, there's a world map here. And if ... ... (Managing Map Layers With HTML, CSS,...
Read more >
Use map layers - Computer - My Maps Help - Google Help
Change the number of layers. Maps are created with one layer, but you can have up to 10. On your computer, sign in...
Read more >
OpenLayers tutorial: map doesn't show up - GIS Stack Exchange
I'm following an OpenLayers tutorial and already there is something wrong after trying to represent a simple map.
Read more >
Troubleshoot—ArcGIS Online Help | Documentation
Map Viewer Classic can't display layers in a map without a working basemap because the basemap establishes the coordinate system of the map....
Read more >
Solved: Getting to Know Web GIS 5th Ed Ch4 Tutorials Incid...
I just tested searching for and adding the layers again and didn't have a problem, try deleting that map, opening a new one...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found