ax.scatter making background figure come to foreground in 3D plot?

时间:2018-09-18 19:46:39

标签: python macos matplotlib 3d

I've been working on this complicated plot of trajectories of rockets and maps and things... I came to the point that I needed to include markers on specific places of my map:

Figure without the marker

It's a long code, that requires a lot of data to reproduce, but when I include this line:

ax.scatter(-147.338786 65.32957 85.001453, c='aqua', marker='o', s = 100, label = 'PMC - Water release'
       ,edgecolors = 'black')

This is the result:

Figure with the marker

I'm using a figure generated with another code to generate the map as a png and add that to the 3D plot like so:

fig = plt.figure(figsize=(16,14))
ax = fig.gca(projection='3d')
ax.w_xaxis.set_pane_color((1.0, 1.0, 1.0, 1.0))
ax.w_yaxis.set_pane_color((1.0, 1.0, 1.0, 1.0))

k=.01
xx, yy = np.meshgrid(np.linspace(xlims[0],xlims[1],377), np.linspace(ylims[0]+k,ylims[1]+k,317))



# create vertices for a rotated mesh (3D rotation matrix)
X = xx#np.cos(theta)
Y = yy#np.sin(theta)
Z = yy*.0-2.

ax.plot_surface(X, Y, Z, rstride=1, cstride=1, facecolors=plt.imread(myfolder + 
'basemap.png'), shade=False)

basemap.png is the name of the map (sized 377x317).

Does anybody know how to override the figure coming to the foreground with the marker? I don't know why it would do that, but that line (ax.scatter) is the only difference between figure 1 and figure 2.

edit: I did change the order of plot calls and so on, with no positive results

0 个答案:

没有答案