下面的代码是从plotly tutorialhttps://plot.ly/python/filled-area-plots/复制的,除了带有opacity
设置的行。在
但是,这不起作用。如何设置填充区域的不透明度?在
import plotly.plotly as py
import plotly.graph_objs as go
# Add original data
x = ['Winter', 'Spring', 'Summer', 'Fall']
trace0 = dict(
x=x,
y=[40, 60, 40, 10],
hoverinfo='x+y',
mode='lines',
##########
opacity = 0.5,
##########
line=dict(width=0.5,
color='rgb(131, 90, 241)'),
stackgroup='one'
)
trace1 = dict(
x=x,
y=[20, 10, 10, 60],
hoverinfo='x+y',
mode='lines',
##########
opacity = 0.5,
##########
line=dict(width=0.5,
color='rgb(111, 231, 219)'),
stackgroup='one'
)
trace2 = dict(
x=x,
y=[40, 30, 50, 30],
hoverinfo='x+y',
mode='lines',
##########
opacity = 0.5,
##########
line=dict(width=0.5,
color='rgb(184, 247, 212)'),
stackgroup='one'
)
data = [trace0, trace1, trace2]
fig = dict(data=data)
py.iplot(fig, filename='stacked-area-plot-hover', validate=False)
您可以通过在
fillcolor
中提供RGBA颜色来设置填充区域图中的不透明度,例如给你
相关问题 更多 >
编程相关推荐