[英]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.