<jupyter_start><jupyter_text>Import the necesary packages<jupyter_code>import plotly as py
import plotly.graph_objs as go
import ipywidgets as widgets
import numpy as np
from scipy import special
import urllib, json


# setup offline mode
py.offline.init_notebook_mode(connected=True)<jupyter_output><empty_output><jupyter_text>Plot a plotly interactive diagram<jupyter_code>x = np.linspace(0, np.pi, 1000)

layout = go.Layout(
    title = 'SIMPLE EXAMPLE',
    yaxis=dict(
        title='volts'
    ),
    xaxis=dict(
        title='nanoseconds'
    )
)

trace1 = go.Scatter(
    x=x,
    y=np.sin(x),
    mode='lines',
    name='sin(x)',
    line=dict(
        shape='spline'
    )
)

fig = go.Figure(data=[trace1], layout=layout)

py.offline.iplot(fig)<jupyter_output><empty_output><jupyter_text>To plot a Sankey diagram<jupyter_code>url = 'https://raw.githubusercontent.com/plotly/plotly.js/master/test/image/mocks/sankey_energy.json'
response = urllib.request.urlopen(url)
data = json.loads(response.read())
fig = go.Figure(data=[go.Sankey(
    valueformat = ".0f",
    valuesuffix = "TWh",
    # Define nodes
    node = dict(
        pad = 15,
        thickness = 15,
        line = dict(color = "black", width = 0.5),
        label =  data['data'][0]['node']['label'],
        color =  data['data'][0]['node']['color']
    ),
    # Add links
    link = dict(
        source =  data['data'][0]['link']['source'],
        target =  data['data'][0]['link']['target'],
        value =  data['data'][0]['link']['value'],
        label =  data['data'][0]['link']['label']
    ))])

fig.show()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.16635859519408502, 'fraction_numerical': 0.012322858903265557, 'mean_word_length': 3.574647887323944, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '231879', 'license': 'Apache-2.0', 'n_tokens_mistral': 594, 'n_tokens_neox': 584, 'n_words': 103, 'path': 'Visualisations/explore_plotly.ipynb', 'repo_name': 'antsh3k/Epilepsy-project', 'size': '1623'}