Home  >  Article  >  Backend Development  >  How to install plotly in python

How to install plotly in python

(*-*)浩
(*-*)浩Original
2019-06-24 15:58:4413156browse

plotly is an interactive, browser-based drawing library. Its main function is to draw online interactive charts. The charts drawn are really pleasing to the eye. The languages ​​it supports are not just Python, but also languages ​​such as r, matlab, javescript, etc. Figures drawn by plotly can be viewed directly in jupyter, or saved as an offline web page, or saved in the plot.ly cloud server for online viewing.

How to install plotly in python

plotly installation is very simple: (recommended learning: Python video tutorial)

pip install plotly

Use plotly

Online drawing

First register a plotly account and generate API key under user avatar-setting-API Keys

Enter in jupyterlab

import plotly.plotly as py
import plotly.graph_objs as go
plotly.tools.set_credentials_file(username='your_name', api_key='your_keys')

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

py.plot(data, filename = 'basic-line', auto_open=True)

For more Python-related technical articles, please visit the Python Tutorial column to learn!

The above is the detailed content of How to install plotly in python. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn