'Geopandas plots no points

I want to plot points using Longitude and Latitude with Geopandas, but nothing gets plotted. How to fix this?

geopandas no plots



Solution 1:[1]

  • it's never easy to answer a question when one has to use OCR to extract the data and code. Here's what I've managed to extract with OCR, there are some errors in sample points
  • this sample works as can be seen by output of plot()
  • what is very clear from your output is the axes make no sense 1e6 is too big. Check your data, do you have longitude / latitudes that are invalid WGS84 bounds: -180.0 -90.0 180.0 90.0
import pandas as pd
import geopandas as gpd

geodata = pd.DataFrame(
    [
        [-88.355555, 30.757778],
        [-120.849722, 46.041111],
        [-113.8875, 8.12],
        [-173.24, 38.54],
        [-85.663611, 46.154444],
        [-98.3555, -119.1342],
        [-9.5932, -11.2836],
        [-3.2948, 38.2224],
        [36.2327, 29.3626],
        [3.3483, 47.5047],
    ],
    columns=["Longitude", "Latitude"],
)

data_gdf = gpd.GeoDataFrame(
    geodata, geometry=gpd.points_from_xy(geodata["Longitude"], geodata["Latitude"])
)
data_gdf.plot()

enter image description here

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Rob Raymond