How to install Plotly on your machine in Python
Installation of Plotly
However, Plotly doesn’t come with Anaconda by default. To install Plotly.py on our machine, we can type the following statement in the command window.
pip install plotly
Online vs. Offline: Plotly
Plotly is more than just a plotting library, it’s also a service. To use it in the online mode, we need to create a user profile and account to store our plots. So, we’ll need to provide the login credentials before we can start generating plots. However, it’s free to use. When we create a plot, it is sending a request to their servers and in return, they send us the results in an HTML format.
Since the python module uses the Plotly.js library for rendering, parameters to the Plotly.py API are passed in dictionary formats. To access this API, we use the Plotly.py package in python. Once we have created the account and received a personal API key, we can start setting up Plotly with the set_credential_files() function as follows.
import plotly plotly.tools.set_credentials_file(username=’YourAccountName’, api_key=’YourAPIKey’)
It also enables us to save graphs locally through Plotly offline mode. In this case, we use plotly.offline.plot() or plotly.offline.iplot() functions to either display the plots within the notebook or create HTML pages that we can save locally on the machine.