【发布时间】:2020-08-13 11:35:18
【问题描述】:
我正在尝试使用 plotly 进行一些可视化。 但是当我尝试进行可视化时,我总是会收到以下错误。
以下是我的代码。
#Boxplot and histogram of Total Direct Variable Cost grouped by with or with Financial Class
import chart_studio.plotly as py
from plotly.offline import iplot
trace0 = go.Box(
y=healthcare.loc[healthcare['A'] == 'Inpatient']['B'],
name = 'Inpatient',
marker = dict(
color = 'rgb(214, 12, 140)',
)
)
trace1 = go.Box(
y=healthcare.loc[healthcare['A'] == 'InBorn']['B'],
name = 'InBorn',
marker = dict(
color = 'rgb(0, 128, 128)',
)
)
data = [trace0, trace1]
layout = go.Layout(
title = "CCCCCCCCCCCC"
)
fig = go.Figure(data=data,layout=layout)
py.iplot(fig)
【问题讨论】:
-
您介意添加完整的mcve吗?
-
那你还在用
python2吗?考虑到从 4.0 版开始,plotly 仅离线,因此您无需再致电plotly.offline。