<jupyter_start><jupyter_text>Interactive plots with Plotly and Cufflinks Plotly is a JS based plotting library with Python bindings (similar to bokeh). Plotly also has a portal online where users can upload their charts for public use. Installation```pip instal plotly``` login```import plotlyplotly.tools.set_credentials_file(username='', api_key='')```create your key here: [https://plot.ly/settings/api](https://plot.ly/settings/api) Online and Offline plottingPlotly allows you to plot both  - online - plot data is set online to your account.   - `plot()` - returns a unique url and opens it new tab   - `iplot()` - when using notebook to embed the plot - offline - explicit call   - `offline.plot` - creates a **new html** output page   - `offline.iplot` - interactive while in a notebook<jupyter_code>import plotly
plotly.tools.set_credentials_file(username='atmamani',
                                  api_key='xxx')<jupyter_output><empty_output><jupyter_text>Online plotting `plot` command<jupyter_code>import plotly.plotly as py
from plotly.graph_objs import *

trace0 = Scatter(
    x=[1, 2, 3, 4],
    y=[10, 15, 13, 17]
)
trace1 = Scatter(
    x=[1, 2, 3, 4],
    y=[16, 5, 11, 9]
)
data = Data([trace0, trace1])

py.plot(data, filename = 'basic-line2')<jupyter_output><empty_output><jupyter_text>`iplot` command<jupyter_code>import plotly.plotly as py
from plotly.graph_objs import *

trace0 = Scatter(
    x=[1, 2, 3, 4],
    y=[10, 15, 13, 17]
)
trace1 = Scatter(
    x=[1, 2, 3, 4],
    y=[16, 5, 11, 9]
)
data = Data([trace0, trace1])

py.iplot(data, filename = 'basic-line')<jupyter_output>High five! You successfully sent some data to your account on plotly. View your plot in your browser at https://plot.ly/~AtmaMani/0 or inside your plot.ly account where it is named 'basic-line'<jupyter_text>Offline plotting `plot` command<jupyter_code>import plotly
from plotly.graph_objs import Scatter, Layout

plotly.offline.plot({
    "data": [Scatter(x=[1, 2, 3, 4], y=[4, 3, 2, 1])],
    "layout": Layout(title="hello world")
})<jupyter_output><empty_output><jupyter_text>`iplot` commandYou need to set initialization code, similar to matplotlib<jupyter_code>import plotly
from plotly.graph_objs import Scatter, Layout

# init code
plotly.offline.init_notebook_mode(connected=True)

plotly.offline.iplot({
    "data": [Scatter(x=[1, 2, 3, 4], y=[4, 3, 2, 1])],
    "layout": Layout(title="hello world")
})<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.13300693594451243, 'fraction_numerical': 0.028559771521827825, 'mean_word_length': 4.689095127610209, 'pattern_counts': {'":': 4, '<': 20, '<?xml version=': 0, '>': 20, 'https://': 3, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '5', 'dir': 'jupyter-structured-clean-dedup', 'id': '421480', 'license': 'MIT', 'n_tokens_mistral': 914, 'n_tokens_neox': 844, 'n_words': 251, 'path': 'python_crash_course/plotly_cufflinks_cheat_sheet_1.ipynb', 'repo_name': 'AtmaMani/pyChakras', 'size': '2451'}