- Plotly - Discussion
- Plotly - Useful Resources
- Plotly - Quick Guide
- Plotly with Matplotlib and Chart Studio
- Plotly with Pandas and Cufflinks
- Plotly - FigureWidget Class
- Plotly - Slider Control
- Plotly - Adding Buttons/Dropdown
- Plotly - 3D Scatter & Surface Plot
- Plotly - OHLC Chart Waterfall Chart & Funnel Chart
- Plotly - Polar Chart & Radar Chart
- Plotly - Heatmap
- Plotly - Distplots, Density Plot & Error Bar Plot
- Plotly - Box Plot Violin Plot & Contour Plot
- Plotly - Histogram
- Plotly - Dot Plots & Table
- Plotly - Scatter Plot, Scattergl Plot & Bubble Charts
- Plotly - Bar Chart & Pie Chart
- Plotly - Subplots & Inset Plots
- Plotly - Format Axis & Ticks
- Plotly - Legends
- Plotly - Exporting to Static Images
- Plotly - Package Structure
- Plotting Inline with Jupyter Notebook
- Plotly - Online & Offline Plotting
- Plotly - Environment Setup
- Plotly - Introduction
- Plotly - Home
Selected Reading
- Who is Who
- Computer Glossary
- HR Interview Questions
- Effective Resume Writing
- Questions and Answers
- UPSC IAS Exams Notes
Plotly - Environment Setup
This chapter focusses on how to do the environmental set up in Python with the help of Plotly.
Installation of Python package
It is always recommended to use Python’s virtual environment feature for installation of a new package. Following command creates a virtual environment in the specified folder.
python -m myenv
To activate the so created virtual environment run activate script in bin sub folder as shown below.
source bin/activate
Now we can install plotly’s Python package as given below using pip utipty.
pip install plotly
You may also want to install Jupyter notebook app which is a web based interface to Ipython interpreter.
pip install jupyter notebook
Firstly, you need to create an account on website which is available at
. You can sign up by using the pnk mentioned herewith and then log in successfully.Next, obtain the API key from settings page of your dashboard.
Use your username and API key to set up credentials on Python interpreter session.
import plotly plotly.tools.set_credentials_file(username= test , api_key= ******************** )
A special file named credentials is created in .plotly subfolder under your home directory. It looks similar to the following −
{ "username": "test", "api_key": "********************", "proxy_username": "", "proxy_password": "", "stream_ids": [] }
In order to generate plots, we need to import the following module from plotly package −
import plotly.plotly as py import plotly.graph_objs as go
plotly.plotly module contains the functions that will help us communicate with the Plotly servers. Functions in plotly.graph_objs module generates graph objects
Advertisements