| 1 | #!/usr/bin/python3 |
| 2 | |
| 3 | import plotly.offline.offline as py |
| 4 | import plotly.graph_objs as go |
| 5 | |
| 6 | # Create random data with numpy |
| 7 | import numpy as np |
| 8 | |
| 9 | N = 100 |
| 10 | random_x = np.linspace(0, 1, N) |
| 11 | random_y0 = np.random.randn(N)+5 |
| 12 | random_y1 = np.random.randn(N) |
| 13 | random_y2 = np.random.randn(N)-5 |
| 14 | |
| 15 | # Create traces |
| 16 | trace0 = go.Scatter( |
| 17 | x = random_x, |
| 18 | y = random_y0, |
| 19 | mode = 'lines', |
| 20 | name = 'lines' |
| 21 | ) |
| 22 | trace1 = go.Scatter( |
| 23 | x = random_x, |
| 24 | y = random_y1, |
| 25 | mode = 'lines+markers', |
| 26 | name = 'lines+markers' |
| 27 | ) |
| 28 | trace2 = go.Scatter( |
| 29 | x = random_x, |
| 30 | y = random_y2, |
| 31 | mode = 'markers', |
| 32 | name = 'markers' |
| 33 | ) |
| 34 | |
| 35 | fig = go.Figure() |
| 36 | fig.add_trace(trace0) |
| 37 | fig.add_trace(trace1) |
| 38 | fig.add_trace(trace2) |
| 39 | print(fig.data) |