Guest User

Untitled

a guest
Sep 25th, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.62 KB | None | 0 0
  1. def stacked_plots(traces, name):
  2. fig = tools.make_subplots(rows = len(traces), cols =1)
  3. for i, trace in enumerate(traces):
  4. j = i + 1
  5. if j%2==0:
  6. j = int(j/2)
  7. else:
  8. j = int((j+1)/2)
  9. fig.append_trace(trace, j, 1)
  10.  
  11. fig['layout'].update(xaxis=dict(
  12. autorange=True,
  13. showgrid=False,
  14. zeroline=False,
  15. showline=False,
  16. ticks='',
  17. showticklabels=False
  18. ),
  19. xaxis2=dict(
  20. autorange=True,
  21. showgrid=False,
  22. zeroline=False,
  23. showline=False,
  24. ticks='',
  25. showticklabels=False
  26. ),
  27. xaxis3=dict(
  28. title = 'Iterations',
  29. #gridcolor='rgb(255,255,255)',
  30. showgrid=True,
  31. showline=False,
  32. showticklabels=True,
  33. tickcolor='rgb(127,127,127)',
  34. ticks='outside',
  35. zeroline=False
  36. ),
  37. yaxis=dict(
  38.  
  39. #gridcolor='rgb(255,255,255)',
  40. showgrid=True,
  41. showline=False,
  42. showticklabels=True,
  43. tickcolor='rgb(127,127,127)',
  44. ticks='outside',
  45. zeroline=False
  46. ),
  47. title=name)
  48.  
  49. return dcc.Graph(
  50. figure=fig,
  51. style={'height': 800},
  52. id=name,
  53. config={
  54. 'displayModeBar': False}
  55. )
  56.  
  57.  
  58. def gray_trace_with_CI(name, ll, max_ll, min_ll):
  59. x = list(np.arange(len(ll)))
  60. x_rev = x[::-1]
  61.  
  62. trace1 = go.Scatter(
  63. x=x,
  64. y=ll,
  65. showlegend=False,
  66. line = dict(
  67. color = ('#808080'),
  68. width = 2))
  69.  
  70. trace2 = go.Scatter(
  71. x=x+x_rev,
  72. y=max_ll+min_ll,
  73. fill='tozerox',
  74. fillcolor='rgba(127,127,127,0.2)',
  75. line=dict(color='rgba(255,255,255,0)'),
  76. showlegend=False
  77. )
  78. return [trace1, trace2]
  79.  
  80. #usage:
  81. #stacked_plots(gray_trace_with_CI(name, ll, max_ll, min_ll), 'one plot')
Add Comment
Please, Sign In to add comment