// can't yet format YamlFrontmatter (["title: Polar bar charts"; "category: Polar Charts"; "categoryindex: 9 "; "index: 2"], Some { StartLine = 2 StartColumn = 0 EndLine = 6 EndColumn = 8 }) to pynb markdown

In [ ]:
#r "nuget: Plotly.NET, 2.0.0-preview.16"
#r "nuget: Plotly.NET.Interactive, 2.0.0-preview.16"

Polar bar charts

BinderScriptNotebook

Summary: This example shows how to create polar bar charts in F#.

let's first create some data for the purpose of creating example charts:

In [3]:
open Plotly.NET 
  
let r   = [77.5; 72.5; 70.0; 45.0; 22.5; 42.5; 40.0; 62.5]
let r2  = [57.5; 50.0; 45.0; 35.0; 20.0; 22.5; 37.5; 55.0]
let r3  = [40.0; 30.0; 30.0; 35.0; 7.5; 7.5; 32.5; 40.0]
let r4  = [20.0; 7.5; 15.0; 22.5; 2.5; 2.5; 12.5; 22.5]

let t = ["North"; "N-E"; "East"; "S-E"; "South"; "S-W"; "West"; "N-W"]

Polar bar charts plot data on a radial axis and a categorical angular axis.

A common use case is the windrose chart.

A wind rose is a graphic tool used by meteorologists to give a succinct view of how wind speed and direction are typically distributed at a particular location.

In [4]:
open Plotly.NET.LayoutObjects

let windrose1 =

    [
        Chart.BarPolar (r , t, Name="11-14 m/s",  MarkerPatternShape = StyleParam.PatternShape.Checked)
        Chart.BarPolar (r2, t, Name="8-11 m/s" ,  MarkerPatternShape = StyleParam.PatternShape.DiagonalChecked)
        Chart.BarPolar (r3, t, Name="5-8 m/s"  ,  MarkerPatternShape = StyleParam.PatternShape.VerticalLines)
        Chart.BarPolar (r4, t, Name="< 5 m/s"  ,  MarkerPatternShape = StyleParam.PatternShape.HorizontalLines)
    ]
    |> Chart.combine
    |> Chart.withAngularAxis(
        AngularAxis.init(
            CategoryOrder = StyleParam.CategoryOrder.Array,
            CategoryArray = (["East"; "N-E"; "North"; "N-W"; "West"; "S-W"; "South"; "S-E";]) // set the order of the categorical axis
        )
    )
In [ ]:
windrose1
Out[ ]: