我正在创建一个带有三个数字的散极图,我有第四个数字,我想确定fillcolor。其中第四个数字可以介于0和1之间,颜色条显示该范围的色阶。你知道吗
我使用的是plotly 3.1.1和python版本3.6.3。你知道吗
我不知道如何让色条影响fillcolor的颜色。到目前为止,我掌握的情况如下:
import plotly.graph_objs as go
num_1 = 0.3
num_2 = 0.6
num_3 = 0.9
num_4 = 0.5
# Create radar plot
data = [go.Scatterpolar(
r = [num_1, num_2, num_3],
theta = ['number_1', 'number_2', 'number_3'],
fill = 'toself',
fillcolor = 'red', # I want this to change based on value of num_4
opacity = 0.5,
marker = dict(
cmin = 0,
cmax = 1,
colorbar = dict(title='title'),
colorscale = 'Viridis'
),
mode = 'markers'
)]
# Create layout
layout = go.Layout(
polar = dict(
radialaxis = dict(visible = True, range = [0, 1])
),
showlegend = False
)
# Plot data (using Jupyter notebook)
fig = go.FigureWidget(data=data, layout=layout)
fig
您可以使用
matplotlib
的colormaps来获取rgba值,可视化库通常具有相同的标准colormaps。你知道吗相关问题 更多 >
编程相关推荐