diff --git a/examples/gallery/lines/linestrings.py b/examples/gallery/lines/linestrings.py index 18f94502f16..c9f6ad25f40 100644 --- a/examples/gallery/lines/linestrings.py +++ b/examples/gallery/lines/linestrings.py @@ -4,43 +4,28 @@ The :meth:`pygmt.Figure.plot` method allows us to plot geographical data such as lines with LineString or MultiLineString geometry types stored in a -:class:`geopandas.GeoDataFrame` object or any object that implements the -`__geo_interface__ `__ property. - -Use :func:`geopandas.read_file` to load data from any supported OGR format such as a -shapefile (.shp), GeoJSON (.geojson), geopackage (.gpkg), etc. Then, pass the -:class:`geopandas.GeoDataFrame` object as an argument to the ``data`` parameter of -:meth:`pygmt.Figure.plot`, and style the lines using the ``pen`` parameter. +:class:`geopandas.GeoDataFrame` object. Use :func:`geopandas.read_file` to load data +from any supported OGR format such as a shapefile (.shp), GeoJSON (.geojson), geopackage +(.gpkg), etc. Then, pass the :class:`geopandas.GeoDataFrame` object as an argument to +the ``data`` parameter of :meth:`pygmt.Figure.plot`, and style the lines using the +``pen`` parameter. """ # %% -import geodatasets import geopandas as gpd import pygmt -# Read a sample dataset provided by the geodatasets package. -# The dataset contains large rivers in Europe, stored as LineString/MultiLineString -# geometry types. -gdf = gpd.read_file(geodatasets.get_path("eea large_rivers")) - -# Convert object to EPSG 4326 coordinate system -gdf = gdf.to_crs("EPSG:4326") -gdf.head() +# Read a sample dataset provided by Natural Earth. The dataset contains rivers stored +# as LineString/MultiLineString geometry types. Here will focus on Asia. +provider = "https://naciscdn.org/naturalearth" +rivers = gpd.read_file(f"{provider}/50m/physical/ne_50m_rivers_lake_centerlines.zip") +rivers_asia = rivers.cx[57:125, 7:47].copy() -# %% fig = pygmt.Figure() - -fig.coast( - projection="M10c", - region=[-10, 30, 35, 57], - resolution="l", - land="gray95", - shorelines="1/0.1p,gray50", - borders="1/0.1,gray30", - frame=True, -) +fig.basemap(region=[57, 125, 7, 47], projection="M10c", frame=True) +fig.coast(land="gray95", shorelines="1/0.3p,gray50") # Add rivers to map -fig.plot(data=gdf, pen="1p,steelblue") +fig.plot(data=rivers_asia, pen="1p,steelblue") fig.show()