我想创建一个三维表面图与plotly库从Pandas Dataframe ,但没有结果显示在python。有人能帮忙吗?谢谢你提前。
import pandas as pd
import plotly as py
import plotly.graph_objects as go
df_final = pd.DataFrame(list(zip( new_storage_p_two, new_storage_c_two, new_storage_result, backward_storage_result, gap)),columns =['P2', 'C2', 'Cycle Time New Sequence', 'Cycle Time Backward Sequence','Cycle Time Difference'])
df_final.head()
z = df_final['Cycle Time Difference'] #.values
x = df_final['P2']
y = df_final['C2']
fig = go.Figure(data=[go.Surface(z=z, x=x, y=y)])
fig.update_traces(contours_z=dict(show=True, usecolormap=True, highlightcolor="limegreen", project_z=True))
fig.update_layout(title='Cycle Time Gap', autosize=False,
width=500, height=500,
margin=dict(l=65, r=50, b=65, t=90))
fig.show()
第一次
1条答案
按热度按时间f4t66c6m1#
您需要删除数据周围的括号。请尝试以下操作: