Нм, я разобрался.
import IPython
import numpy as np
import plotly.graph_objs as go
from plotly.offline import download_plotlyjs, init_notebook_mode, iplot
def configure_plotly_browser_state():
display(IPython.core.display.HTML('''
<script src="/static/components/requirejs/require.js"></script>
<script>
requirejs.config({
paths: {
base: '/static/base',
plotly: 'https://cdn.plot.ly/plotly-1.5.1.min.js?noext',
},
});
</script>
'''))
configure_plotly_browser_state()
init_notebook_mode(connected=False)
trace1 = go.Scatter(
x= x_data,
y= y_data,
marker={'color': 'blue', 'symbol': 42, 'size': "10"},
mode='lines+markers+text',
name = 'Data1',
hoverinfo = 'x+y'
)
trace2 = go.Scatter(
x= x_data2,
y= y_data2,
marker={'color': 'red', 'symbol': 42, 'size': "10"},
mode='lines+markers+text',
name='Data2',
hoverinfo = 'x+y'
)
layout = go.Layout(
autosize=True,
title='Interactive chart',
xaxis=dict(
title='Title',
titlefont=dict(
family='Courier New, monospace',
size=18,
color='#7f7f7f'
)
),
yaxis=dict(
title='Title',
titlefont=dict(
family='Courier New, monospace',
size=18,
color='#7f7f7f'
)
)
)
fig = go.Figure(data=[trace1, trace2], layout = layout)
iplot(fig)