[英]How to plot 3D surface plots using Plotly in Python?
我可以通过以下代码使用matplotlib
获得 Surface Plot:
ax = figure.gca(projection = "3d")
ax.plot_surface(meshed_slopes, meshed_intercepts, errors.reshape(1, meshed_slopes.shape[0]), cmap = cm.autumn_r)
但是当我尝试使用Plotly做同样的事情时,我得到一个空白图表。
这是用于 plot 曲面图的代码-
import plotly.graph_objects as go
import numpy as np
meshed_slopes, meshed_intercepts = np.meshgrid(slopes, intercepts)
fig = go.Figure(go.Surface(
x = meshed_slopes,
y = meshed_intercepts,
z = errors.reshape(1, meshed_slopes.shape[0])
))
fig.show()
我怎样才能解决这个问题?
提前致谢!!!
由于您尚未提供数据,因此我们可以看一下我将解释 plotly 需要什么才能使 plot 工作:
我建议使用 dataframe,因为它可能更容易创建所有内容
(因为我的人气低,所以我不能写评论所以我把它贴出来作为回答)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.