Python Forum
python basemap, cant show the right coordinates - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: python basemap, cant show the right coordinates (/thread-37420.html)



python basemap, cant show the right coordinates - dbsr - Jun-08-2022

I'm trying to show points on a map. For some reason, i get a map with a single point at the bottom left of the figure. I checked the coordinates and they are fine. I also tried to set other specific coordinate (which i know they must be in the area) and got the same thing. Anyone have an idea what could be the problem? Any help will be appreciated!
def event_trajectory(nclib,plib):
    latslst,lonslst=([],[])

    for i in plib:
        lats,lons = latlon_coords(i[unravel_index(i.argmax(), i.shape)])
        latslst.append(lats)
        lonslst.append(lons)

    bm = get_basemap(plib[5])
    fig = plt.figure(figsize=(12,9))
    bm.drawcoastlines(linewidth=0.25)
    bm.drawstates(linewidth=0.25)
    bm.drawcountries(linewidth=0.25)

    plt.scatter(to_np(latslst),to_np(lonslst),marker = 'o', color='b',zorder=5)

    plt.show()