#!/usr/bin/env python # coding: utf-8 # #### New to Plotly? # Plotly's Python library is free and open source! [Get started](https://plotly.com/python/getting-started/) by dowloading the client and [reading the primer](https://plotly.com/python/getting-started/). #
You can set up Plotly to work in [online](https://plotly.com/python/getting-started/#initialization-for-online-plotting) or [offline](https://plotly.com/python/getting-started/#initialization-for-offline-plotting) mode, or in [jupyter notebooks](https://plotly.com/python/getting-started/#start-plotting-online). #
We also have a quick-reference [cheatsheet](https://images.plot.ly/plotly-documentation/images/python_cheat_sheet.pdf) (new!) to help you get started! # #### Imports # The tutorial below imports [NumPy](http://www.numpy.org/), [Pandas](https://plotly.com/pandas/intro-to-pandas-tutorial/), and [SciPy](https://www.scipy.org/). # In[1]: 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 # #### Import Data # For this example we will use some real data of wind speeds sampled every 10 minutes. # In[2]: 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') # #### Histogram # 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](https://plotly.com/python/histograms/). # In[3]: data = [ go.Histogram( x=wind_data['10 Min Std Dev'], histnorm='probability' ) ] py.iplot(data, filename='wind-data-histogram') # #### Box Plots # 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](https://plotly.com/python/box-plots/). # In[4]: data = [ go.Box( y=wind_data['10 Min Std Dev'], ) ] py.iplot(data, filename='wind-data-box-plot') # #### Scatterplot Matrix # 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](https://plotly.com/python/scatterplot-matrix/). # In[5]: fig = FF.create_scatterplotmatrix(wind_data, height=1000, width=1000, title='Wind Data - Scatterplot Matrix') py.iplot(fig, filename='wind-data-scatterplot-matrix') # In[1]: from IPython.display import display, HTML display(HTML('')) display(HTML('')) get_ipython().system(' 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') # In[ ]: