Plotly's Python library is free and open source! Get started by dowloading the client and reading the primer.
You can set up Plotly to work in online or offline mode, or in jupyter notebooks.
We also have a quick-reference cheatsheet (new!) to help you get started!
import plotly.plotly as py
import plotly.graph_objs as go
from plotly.tools import FigureFactory as FF
import numpy as np
import pandas as pd
import scipy
For this example we will use some real data of wind speeds sampled every 10 minutes.
wind_data = pd.read_csv('https://raw.githubusercontent.com/plotly/datasets/master/wind_speed_laurel_nebraska.csv')
df = wind_data[0:10]
table = FF.create_table(df)
py.iplot(table, filename='wind-data-sample')
We will be producing a histogram
with the "10 Min Std Dev" column of our data. For more info on the histogram charts, you can checkout the documentation page.
data = [
go.Histogram(
x=wind_data['10 Min Std Dev'],
histnorm='probability'
)
]
py.iplot(data, filename='wind-data-histogram')
We will be producing a box plot
with the "10 Min Std Dev" column of our data again. For more info on the histogram charts, you can checkout the documentation page.
data = [
go.Box(
y=wind_data['10 Min Std Dev'],
)
]
py.iplot(data, filename='wind-data-box-plot')
We will be producing a scatterplot matrix
with all the columns of our data. For more info on the histogram charts, you can checkout the documentation page.
fig = FF.create_scatterplotmatrix(wind_data,
height=1000,
width=1000,
title='Wind Data - Scatterplot Matrix')
py.iplot(fig, filename='wind-data-scatterplot-matrix')
This is the format of your plot grid: [ (1,1) x1,y1 ] [ (1,2) x2,y2 ] [ (1,3) x3,y3 ] [ (2,1) x4,y4 ] [ (2,2) x5,y5 ] [ (2,3) x6,y6 ] [ (3,1) x7,y7 ] [ (3,2) x8,y8 ] [ (3,3) x9,y9 ]
from IPython.display import display, HTML
display(HTML('<link href="//fonts.googleapis.com/css?family=Open+Sans:600,400,300,200|Inconsolata|Ubuntu+Mono:400,700" rel="stylesheet" type="text/css" />'))
display(HTML('<link rel="stylesheet" type="text/css" href="http://help.plot.ly/documentation/all_static/css/ipython-notebook-custom.css">'))
! pip install git+https://github.com/plotly/publisher.git --upgrade
import publisher
publisher.publish(
'python-Statistics-Charts.ipynb', 'python/statistics-charts/', 'Statistics Charts | plotly',
'Learn how to plot statistical data with various charts using Python.',
title='Statistics Charts in Python. | plotly',
name='Statistics Charts',
language='python',
page_type='example_index', has_thumbnail='false', display_as='statistics', order=5,
ipynb= '~notebook_demo/116')
Collecting git+https://github.com/plotly/publisher.git Cloning https://github.com/plotly/publisher.git to /var/folders/ld/6cl3s_l50wd40tdjq2b03jxh0000gp/T/pip-T9GlYL-build Installing collected packages: publisher Found existing installation: publisher 0.10 Uninstalling publisher-0.10: Successfully uninstalled publisher-0.10 Running setup.py install for publisher ... - \ done Successfully installed publisher-0.10
/Users/brandendunbar/Desktop/test/venv/lib/python2.7/site-packages/IPython/nbconvert.py:13: ShimWarning: The `IPython.nbconvert` package has been deprecated. You should import from nbconvert instead. "You should import from nbconvert instead.", ShimWarning) /Users/brandendunbar/Desktop/test/venv/lib/python2.7/site-packages/publisher/publisher.py:53: UserWarning: Did you "Save" this notebook before running this command? Remember to save, always save. warnings.warn('Did you "Save" this notebook before running this command? '