跨3D surface_plot的3D scatter_plot

时间:2018-01-23 17:14:04

标签: python matplotlib 3d mplot3d

使用以下代码,我尝试在3D曲面图上绘制单个散点图。但它没有用。尝试了Axes3D.text(x, y, z, s, zdir=None, **kwargs)而不是Axes3D.scatter(xs, ys, zs=0, zdir='z', s=20, c=None, depthshade=True,*args, **kwargs)。所以我很好奇为什么分散不起作用。我做错了什么?

代码

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()

enter image description here

0 个答案:

没有答案