1
我想要得到我預先生成的cbrewer Reds顏色映射。 但是,當我嘗試使用它時,我仍然得到一些默認的顏色映射。我究竟做錯了什麼? 這裏是情節:https://plot.ly/~smirnod1/54/confusion-matrix/plot.ly熱圖colorscale不起作用
下面是一個代碼示例:
import plotly.plotly as py
from plotly.graph_objs import *
py.sign_in('username', 'api_key')
data = Data([
Heatmap(
x=['Not Churned', 'Churned'],
y=['Churned', 'Not Churned'],
z=[[128, 355], [2827, 23]],
autocolorscale=False,
colorscale=[[1, 'rgb(255,245,240)'], [417, 'rgb(254,224,210)'], [834, 'rgb(252,187,161)'], [1250, 'rgb(252,146,114)'], [1667, 'rgb(251,106,74)'], [2083, 'rgb(239,59,44)'], [2500, 'rgb(203,24,29)'], [2916, 'rgb(165,15,21)'], [3333, 'rgb(103,0,13)']],
name='y',
xsrc='smirnod1:55:b1dfa9',
ysrc='smirnod1:55:b2cd71',
zsrc='smirnod1:55:a9af99,9984f6'
)
])
layout = Layout(
barmode='overlay',
height=400,
title='Confusion Matrix',
width=400,
xaxis=XAxis(
title='Predicted value',
titlefont=dict(
color='#7f7f7f',
size=18
)
),
yaxis=YAxis(
title='True Value',
titlefont=dict(
color='#7f7f7f',
size=18
)
)
)
fig = Figure(data=data, layout=layout)
plot_url = py.plot(fig)