Plotly and Cufflinks
Published: 2023-01-16 06:53:36

Plotly is a interactive python library and cufflinks connects plotly with pandas. 

First we need to-
`pip install plotly`
`pip install cufflinks`
`pip install chart_studio`

Then we need to do these-

```
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import chart_studio.plotly as py
import cufflinks as cf
%matplotlib inline
from plotly import __version__
from plotly.offline import download_plotlyjs, init_notebook_mode, plot, iplot
init_notebook_mode(connected=True)
cf.go_offline()
```
Ahh...now if you don't want to know what are they for just go forward or-
**Explanation:**
- We will require plotly version greater than 1.9.0, if you don't have it update plotly
- We need to give comman to use open source library of plotly.
`from plotly.offline import download_plotlyjs, init_notebook_mode, plot, iplot` 
<u>N.B.</u> Plotly is a company that offers online and offline facilities. Some are paid. For our usage we are going to use the offline free services.
-`init_notebook_mode(connected=True)` connects javascript with notebook. Plotly is gonna basically use pandas and python to javascript library
- `cf.go_offline()` will allow cufflink use offline

In Matplotlib we use `.plot()`, in plotly we use `iplotly()`
So, it is **i** that is the difference in a sense.
Obviously the arguments are not same.

Basically plotly and cufflinks makes different kinds of plots based on data like matplotly but plotly is interactive and has more dimensions to it. Let's see-

But first let's see  for the basics which plots we are gonna discuss-

- scatter
- bar
- box
- spread
- ratio
- heatmap
- surface
- histogram
- bubble

Now-
![01](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zse8liaowtx37xon3huh.png)
![05](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/62y6rixq3apevmkz0y5w.png)
##Scatter:
![02](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xpiomtbz91cc81t0q78y.png)
**We have some tools in the right top corner of the plot when we hover the mouse on it. The legends are also interactive.**
![03](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ja85z9fd483ra3us90b9.png)
**That's one of the advantages we get. Plus the interactive part-**
![04](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vcriyxbxai197ki7wd46.png)
##Bar:
![06](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/u36kdzhd3fmx9ya1bfsn.png)

##Box:
![07](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3p43e40tid4zljex2no4.png)
##Spread:
![08](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6oj4ifxj6ixbt7guu0bt.png)
![09](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1bc7m07bsatfo68ynfg3.png)
##Ratio:
![10](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6k9uq8xmb6bbokts75qk.png)
##Heatmap:
![11](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bdlqizngjlgppjzxxtsr.png)
##Surface:
![12](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cx7ri94t7p0xrh64jgam.png)
We can rotate the plot
##Histogram:
![13](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2086j8ydabve3kt965ds.png)
##Bubble:
![14](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/iom4sqdf2petff99k5uz.png)

in `.iplot()` there's tons of arguments use `shift+tab` to see them. Now play with the interactive powers. Play with it to know it....