Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def stacked_plots(traces, name):
- fig = tools.make_subplots(rows = len(traces), cols =1)
- for i, trace in enumerate(traces):
- j = i + 1
- if j%2==0:
- j = int(j/2)
- else:
- j = int((j+1)/2)
- fig.append_trace(trace, j, 1)
- fig['layout'].update(xaxis=dict(
- autorange=True,
- showgrid=False,
- zeroline=False,
- showline=False,
- ticks='',
- showticklabels=False
- ),
- xaxis2=dict(
- autorange=True,
- showgrid=False,
- zeroline=False,
- showline=False,
- ticks='',
- showticklabels=False
- ),
- xaxis3=dict(
- title = 'Iterations',
- #gridcolor='rgb(255,255,255)',
- showgrid=True,
- showline=False,
- showticklabels=True,
- tickcolor='rgb(127,127,127)',
- ticks='outside',
- zeroline=False
- ),
- yaxis=dict(
- #gridcolor='rgb(255,255,255)',
- showgrid=True,
- showline=False,
- showticklabels=True,
- tickcolor='rgb(127,127,127)',
- ticks='outside',
- zeroline=False
- ),
- title=name)
- return dcc.Graph(
- figure=fig,
- style={'height': 800},
- id=name,
- config={
- 'displayModeBar': False}
- )
- def gray_trace_with_CI(name, ll, max_ll, min_ll):
- x = list(np.arange(len(ll)))
- x_rev = x[::-1]
- trace1 = go.Scatter(
- x=x,
- y=ll,
- showlegend=False,
- line = dict(
- color = ('#808080'),
- width = 2))
- trace2 = go.Scatter(
- x=x+x_rev,
- y=max_ll+min_ll,
- fill='tozerox',
- fillcolor='rgba(127,127,127,0.2)',
- line=dict(color='rgba(255,255,255,0)'),
- showlegend=False
- )
- return [trace1, trace2]
- #usage:
- #stacked_plots(gray_trace_with_CI(name, ll, max_ll, min_ll), 'one plot')
Add Comment
Please, Sign In to add comment