trace = go.Scatter(
x=x_pca_df['Principle'],
y=x_pca_df['Second'],
mode='markers',
marker=dict(color=home_data['PriceLevel'], size=4, showscale=False))
data = [trace]
layout = dict(
title='PCA Analysis',
xaxis=dict(title='First Principle Component'),
yaxis=dict(title='Second Principle Component'))
fig = dict(data=data, layout=layout)
iplot(fig)
Run Code Online (Sandbox Code Playgroud)
我认为您需要指定文件名参数。试试这个,让我知道它是否有效。
trace = go.Scatter(
x=x_pca_df['Principle'],
y=x_pca_df['Second'],
mode='markers',
marker=dict(color=home_data['PriceLevel'], size=4, showscale=False))
data = [trace]
layout = dict(
title='PCA Analysis',
xaxis=dict(title='First Principle Component'),
yaxis=dict(title='Second Principle Component'), showlegend = True)
fig = dict(data=data, layout=layout)
iplot(fig, filename = 'show-legend')
Run Code Online (Sandbox Code Playgroud)