#!/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 downloading 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!
# #### Basic Wind Rose Chart
# In[2]:
import plotly.plotly as py
import plotly.graph_objs as go
trace1 = go.Barpolar(
r=[77.5, 72.5, 70.0, 45.0, 22.5, 42.5, 40.0, 62.5],
text=['North', 'N-E', 'East', 'S-E', 'South', 'S-W', 'West', 'N-W'],
name='11-14 m/s',
marker=dict(
color='rgb(106,81,163)'
)
)
trace2 = go.Barpolar(
r=[57.49999999999999, 50.0, 45.0, 35.0, 20.0, 22.5, 37.5, 55.00000000000001],
text=['North', 'N-E', 'East', 'S-E', 'South', 'S-W', 'West', 'N-W'],
name='8-11 m/s',
marker=dict(
color='rgb(158,154,200)'
)
)
trace3 = go.Barpolar(
r=[40.0, 30.0, 30.0, 35.0, 7.5, 7.5, 32.5, 40.0],
text=['North', 'N-E', 'East', 'S-E', 'South', 'S-W', 'West', 'N-W'],
name='5-8 m/s',
marker=dict(
color='rgb(203,201,226)'
)
)
trace4 = go.Barpolar(
r=[20.0, 7.5, 15.0, 22.5, 2.5, 2.5, 12.5, 22.5],
text=['North', 'N-E', 'East', 'S-E', 'South', 'S-W', 'West', 'N-W'],
name='< 5 m/s',
marker=dict(
color='rgb(242,240,247)'
)
)
data = [trace1, trace2, trace3, trace4]
layout = go.Layout(
title='Wind Speed Distribution in Laurel, NE',
font=dict(
size=16
),
legend=dict(
font=dict(
size=16
)
),
radialaxis=dict(
ticksuffix='%'
),
orientation=270
)
fig = go.Figure(data=data, layout=layout)
py.iplot(fig, filename='polar-area-chart')
# #### Reference
#
# See https://plotly.com/python/reference/#barpolar for more information and chart attribute options!
# 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(
'wind-rose.ipynb', 'python/wind-rose-charts/', 'Python Wind Rose Charts | plotly',
'How to graph wind rose charts in python. Wind Rose charts display wind speed and direction of a given location. ',
title = 'Python Wind Rose Charts | plotly',
name = 'Wind Rose Charts',
has_thumbnail='true', thumbnail='thumbnail/wind-rose.jpg',
language='python', page_type='example_index',
display_as='scientific', order=8,
ipynb= '~notebook_demo/38')
# In[ ]: