Skip to content

ValueError: 'vertices' must be a 2D list or array with shape Nx2 #512

@flaviodoliveira

Description

@flaviodoliveira

I'm using Python 3.8.5
Matplotlib version 3.1.2
and basemap-1.2.2+dev

I'm running something like:


    llon = lons.min()
    llat = lats.min()
    ulon = lons.max()
    ulat = lats.max()

    fig, ax = plt.subplots()
    
    m = Basemap(llcrnrlon=llon, llcrnrlat=llat, urcrnrlon=ulon,
                urcrnrlat=ulat, resolution='h')

    m.drawcoastlines(linewidth=0.8)
    m.drawcountries(linewidth=0.8)
    m.drawstates(linewidth=0.8)


and then I got this:

File "plt_RAIN.py", line 62, in
m.drawcoastlines(linewidth=0.8)
File "/usr/local/lib/python3.8/dist-packages/mpl_toolkits/basemap/init.py", line 1859, in drawcoastlines
coastlines = LineCollection(self.coastsegs,antialiaseds=(antialiased,))
File "/usr/lib/python3/dist-packages/matplotlib/collections.py", line 1333, in init
self.set_segments(segments)
File "/usr/lib/python3/dist-packages/matplotlib/collections.py", line 1348, in set_segments
self._paths = [mpath.Path(_seg) for _seg in _segments]
File "/usr/lib/python3/dist-packages/matplotlib/collections.py", line 1348, in
self._paths = [mpath.Path(_seg) for _seg in _segments]
File "/usr/lib/python3/dist-packages/matplotlib/path.py", line 129, in init
raise ValueError(
ValueError: 'vertices' must be a 2D list or array with shape Nx2

I checked everything, but I'm used to run this on basemap 1.0.7 and everything was ok.
And when I run without m.drawcoastlines(), there is no problem.

What can I do to run it?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions