0

With the following code I try to plot a single scatter point over a 3D surface plot. But it is not working. Have tried Axes3D.text(x, y, z, s, zdir=None, **kwargs) instead of Axes3D.scatter(xs, ys, zs=0, zdir='z', s=20, c=None, depthshade=True,*args, **kwargs) which works. So I am curious why scatter is not working. What am I doing wrong?

Code

import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
from matplotlib import cm
from pylab import figure
from mpl_toolkits.mplot3d import Axes3D




fig = figure(figsize=(30,30))
ax = Axes3D(fig)


x=160+np.linspace(-100,100,100)
y=245+np.linspace(-100,100,100)

X,Y=np.meshgrid(x.round(0),y.round(0))




print(threshold1)


Z=Y-X

ax.plot_surface(X,Y,Z,cmap=cm.coolwarm,linewidth=3)
ax.scatter(160,245,85,s=400,c="b")
ax.tick_params(labelsize=35,direction='out', length=6, width=2)


plt.show()

Figure

enter image description here

ImportanceOfBeingErnest
  • 321,279
  • 53
  • 665
  • 712
2Obe
  • 3,570
  • 6
  • 30
  • 54
  • 1
    scatter would expect 3 lists or arrays as input, not single numbers. So I would try `ax.scatter([160],[245],[85])`. If that doesn't help, did you check if the point is on the other side of the plane? – ImportanceOfBeingErnest Jan 23 '18 at 21:01
  • You are right, it seems as if the plane overlies the scatter point. If I use [250],[150],[85] as x y z Arguments for the scatter, the scatter is visible – 2Obe Jan 24 '18 at 06:53
  • How can I change that the scatter overlies the plane. Simply changing the plotting order is not working – 2Obe Jan 24 '18 at 06:54

0 Answers0