底图上的“map.scatter”不显示标记

`map.scatter` on basemap not displaying markers

我有一张德国地图,还有几个城市的坐标。 plot 正确显示点。我想改用 scatter,以便能够根据其他变量对市场进行着色,然后显示 colorbar。代码在控制台中运行,但是当我将 map.plot 替换为 map.scatter 时,这些点没有可视化。

from mpl_toolkits.basemap import Basemap
import matplotlib.pyplot as plt
import numpy as np


plt.figure(1)
map = Basemap(projection='merc',
              resolution='l',
              llcrnrlat=44.0,
              llcrnrlon=5.0,
              urcrnrlat=57.0,
              urcrnrlon=17)
map.drawcoastlines()
map.drawcountries()
map.fillcontinents(color='lightgray')
map.drawmapboundary()

long = np.array([ 13.404954,  11.581981,   9.993682,   8.682127,   6.960279,
         6.773456,   9.182932,  12.373075,  13.737262,  11.07675 ,
         7.465298,   7.011555,  12.099147,   9.73201 ,   7.628279,
         8.801694,  10.52677 ,   8.466039,   8.239761,  10.89779 ,
         8.403653,   8.532471,   7.098207,   7.216236,   9.987608,
         7.626135,  11.627624,   6.852038,  10.686559,   8.047179,
         8.247253,   6.083887,   7.588996,   9.953355,  10.122765])

lat = np.array([ 52.520007,  48.135125,  53.551085,  50.110922,  50.937531,
        51.227741,  48.775846,  51.339695,  51.050409,  49.45203 ,
        51.513587,  51.455643,  54.092441,  52.375892,  51.36591 ,
        53.079296,  52.268874,  49.487459,  50.078218,  48.370545,
        49.00689 ,  52.030228,  50.73743 ,  51.481845,  48.401082,
        51.960665,  52.120533,  51.47512 ,  53.865467,  52.279911,
        49.992862,  50.775346,  50.356943,  49.791304,  54.323293])

colors = np.array([ 2.72189792,  3.62138986,  1.7947676 ,  1.36524602,  1.75664228,
        3.0777491 ,  2.39580451,  1.17822874,  1.35503558,  2.28517658,
        3.66472978,  1.76467741,  0.72551119,  1.76997962,  4.49420944,
        2.34434288,  1.3243405 ,  2.35945794,  3.16147488,  2.94025564,
        1.68774158,  0.67602518,  1.60727613,  1.85608281,  3.57769226,
        1.33501838,  3.32549868,  2.95492675,  2.83391381,  2.33983198,
        2.59607424,  1.24260218,  1.89258818,  2.07508363,  3.03319927])

x, y = map(long, lat)
map.plot(x,y,'o')
plt.show()

尝试添加 "zorder" 以便点显示在地图上方:

    map.fillcontinents(color='lightgray',zorder=0)

我也遇到了已接受答案的评论中提到的问题(整个地图变成蓝色)所以我最终增加了情节的 zorder :

map.plot(x,y,'o',zorder=9999)