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:

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.

let windrose1 =
    [
        Chart.BarPolar (r , t, Name="11-14 m/s")
        Chart.BarPolar (r2, t, Name="8-11 m/s")
        Chart.BarPolar (r3, t, Name="5-8 m/s")
        Chart.BarPolar (r4, t, Name="< 5 m/s")
    ]
    |> Chart.combine
    |> Chart.withAngularAxis(
        Axis.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
        )
    )
namespace Plotly
namespace Plotly.NET
val r : float list
val r2 : float list
val r3 : float list
val r4 : float list
val t : string list
val windrose1 : GenericChart.GenericChart
type Chart = static member Area : x:seq<#IConvertible> * y:seq<#IConvertible> * ?Name:string * ?ShowMarkers:bool * ?Showlegend:bool * ?MarkerSymbol:Symbol * ?Color:string * ?Opacity:float * ?Labels:seq<#IConvertible> * ?TextPosition:TextPosition * ?TextFont:Font * ?Dash:DrawingStyle * ?Width:float -> GenericChart + 1 overload static member Bar : keys:seq<#IConvertible> * values:seq<#IConvertible> * ?Name:string * ?Showlegend:bool * ?Color:string * ?Opacity:float * ?Labels:seq<#IConvertible> * ?TextPosition:TextPosition * ?TextFont:Font * ?Marker:Marker -> GenericChart + 1 overload static member BarPolar : r:seq<#IConvertible> * theta:seq<#IConvertible> * ?Name:string * ?Showlegend:bool * ?Color:string * ?Opacity:float * ?Labels:seq<#IConvertible> * ?TextPosition:TextPosition * ?TextFont:Font * ?Dash:DrawingStyle * ?LineWidth:float -> GenericChart static member BoxPlot : ?x:'a0 * ?y:'a1 * ?Name:string * ?Showlegend:bool * ?Color:string * ?Fillcolor:'a2 * ?Opacity:float * ?Whiskerwidth:'a3 * ?Boxpoints:Boxpoints * ?Boxmean:BoxMean * ?Jitter:'a4 * ?Pointpos:'a5 * ?Orientation:Orientation * ?Marker:Marker * ?Line:Line * ?Alignmentgroup:'a6 * ?Offsetgroup:'a7 * ?Notched:bool * ?NotchWidth:float * ?QuartileMethod:QuartileMethod -> GenericChart + 1 overload static member Bubble : x:seq<#IConvertible> * y:seq<#IConvertible> * sizes:seq<#IConvertible> * ?Name:string * ?Showlegend:bool * ?MarkerSymbol:Symbol * ?Color:string * ?Opacity:float * ?Labels:seq<#IConvertible> * ?TextPosition:TextPosition * ?TextFont:Font * ?StackGroup:string * ?Orientation:Orientation * ?GroupNorm:GroupNorm * ?UseWebGL:bool -> GenericChart + 1 overload static member Bubble3d : x:seq<#IConvertible> * y:seq<#IConvertible> * z:seq<#IConvertible> * sizes:seq<#IConvertible> * ?Name:string * ?Showlegend:bool * ?MarkerSymbol:Symbol * ?Color:string * ?Opacity:float * ?Labels:seq<#IConvertible> * ?TextPosition:TextPosition * ?TextFont:Font -> GenericChart + 1 overload static member BubblePolar : r:seq<#IConvertible> * theta:seq<#IConvertible> * sizes:seq<#IConvertible> * ?Name:string * ?Showlegend:bool * ?MarkerSymbol:Symbol * ?Color:string * ?Opacity:float * ?Labels:seq<#IConvertible> * ?TextPosition:TextPosition * ?TextFont:Font * ?UseWebGL:bool -> GenericChart + 1 overload static member Candlestick : open:seq<#IConvertible> * high:seq<#IConvertible> * low:seq<#IConvertible> * close:seq<#IConvertible> * x:seq<#IConvertible> * ?Increasing:Line * ?Decreasing:Line * ?WhiskerWidth:float * ?Line:Line * ?XCalendar:Calendar -> GenericChart + 1 overload static member ChoroplethMap : locations:seq<string> * z:seq<#IConvertible> * ?Text:seq<#IConvertible> * ?Locationmode:LocationFormat * ?Autocolorscale:bool * ?Colorscale:Colorscale * ?ColorBar:ColorBar * ?Marker:Marker * ?GeoJson:'a2 * ?FeatureIdKey:string * ?Zmin:float * ?Zmax:float -> GenericChart static member ChoroplethMapbox : locations:seq<#IConvertible> * z:seq<#IConvertible> * geoJson:'a2 * ?FeatureIdKey:string * ?Text:seq<#IConvertible> * ?Below:string * ?Colorscale:Colorscale * ?ColorBar:ColorBar * ?ZAuto:bool * ?ZMin:float * ?ZMid:float * ?ZMax:float -> GenericChart ...
<summary> Provides a set of static methods for creating charts. </summary>
static member Chart.BarPolar : r:seq<#System.IConvertible> * theta:seq<#System.IConvertible> * ?Name:string * ?Showlegend:bool * ?Color:string * ?Opacity:float * ?Labels:seq<#System.IConvertible> * ?TextPosition:StyleParam.TextPosition * ?TextFont:Font * ?Dash:StyleParam.DrawingStyle * ?LineWidth:float -> GenericChart.GenericChart
static member Chart.combine : gCharts:seq<GenericChart.GenericChart> -> GenericChart.GenericChart
static member Chart.withAngularAxis : angularAxis:Axis.AngularAxis * ?Id:StyleParam.SubPlotId -> (GenericChart.GenericChart -> GenericChart.GenericChart)
module Axis from Plotly.NET
<summary>Various axes that can be used to add scales to your plots.</summary>
Multiple items
type AngularAxis = inherit DynamicObj new : unit -> AngularAxis static member init : ?Visible:bool * ?AxisType:AxisType * ?AutoTypeNumbers:AutoTypeNumbers * ?CategoryOrder:CategoryOrder * ?CategoryArray:seq<#IConvertible> * ?ThetaUnit:AngularUnit * ?Period:float * ?Direction:Direction * ?Rotation:int * ?HoverFormat:string * ?UIRevision:#IConvertible * ?Color:string * ?ShowLine:bool * ?LineColor:string * ?LineWidth:int * ?ShowGrid:bool * ?GridColor:string * ?GridWidth:int * ?TickMode:TickMode * ?NTicks:int * ?Tick0:#IConvertible * ?DTick:#IConvertible * ?TickVals:seq<#IConvertible> * ?TickText:seq<#IConvertible> * ?Ticks:TickOptions * ?TickLen:int * ?TickWidth:int * ?TickColor:string * ?ShowTickLabels:bool * ?ShowTickPrefix:ShowTickOption * ?TickPrefix:string * ?ShowTickSuffix:ShowTickOption * ?TickSuffix:string * ?ShowExponent:ShowExponent * ?ExponentFormat:ExponentFormat * ?MinExponent:float * ?SeparateThousands:bool * ?TickFont:Font * ?TickAngle:int * ?TickFormat:string * ?TickFormatStops:seq<TickFormatStop> * ?Layer:Layer -> AngularAxis static member style : ?Visible:bool * ?AxisType:AxisType * ?AutoTypeNumbers:AutoTypeNumbers * ?CategoryOrder:CategoryOrder * ?CategoryArray:seq<#IConvertible> * ?ThetaUnit:AngularUnit * ?Period:float * ?Direction:Direction * ?Rotation:int * ?HoverFormat:string * ?UIRevision:#IConvertible * ?Color:string * ?ShowLine:bool * ?LineColor:string * ?LineWidth:int * ?ShowGrid:bool * ?GridColor:string * ?GridWidth:int * ?TickMode:TickMode * ?NTicks:int * ?Tick0:#IConvertible * ?DTick:#IConvertible * ?TickVals:seq<#IConvertible> * ?TickText:seq<#IConvertible> * ?Ticks:TickOptions * ?TickLen:int * ?TickWidth:int * ?TickColor:string * ?ShowTickLabels:bool * ?ShowTickPrefix:ShowTickOption * ?TickPrefix:string * ?ShowTickSuffix:ShowTickOption * ?TickSuffix:string * ?ShowExponent:ShowExponent * ?ExponentFormat:ExponentFormat * ?MinExponent:float * ?SeparateThousands:bool * ?TickFont:Font * ?TickAngle:int * ?TickFormat:string * ?TickFormatStops:seq<TickFormatStop> * ?Layer:Layer -> (AngularAxis -> AngularAxis)
<summary>Angular axes can be used as a scale for the angular coordinates in polar plots.</summary>

--------------------
new : unit -> Axis.AngularAxis
static member Axis.AngularAxis.init : ?Visible:bool * ?AxisType:StyleParam.AxisType * ?AutoTypeNumbers:StyleParam.AutoTypeNumbers * ?CategoryOrder:StyleParam.CategoryOrder * ?CategoryArray:seq<#System.IConvertible> * ?ThetaUnit:StyleParam.AngularUnit * ?Period:float * ?Direction:StyleParam.Direction * ?Rotation:int * ?HoverFormat:string * ?UIRevision:#System.IConvertible * ?Color:string * ?ShowLine:bool * ?LineColor:string * ?LineWidth:int * ?ShowGrid:bool * ?GridColor:string * ?GridWidth:int * ?TickMode:StyleParam.TickMode * ?NTicks:int * ?Tick0:#System.IConvertible * ?DTick:#System.IConvertible * ?TickVals:seq<#System.IConvertible> * ?TickText:seq<#System.IConvertible> * ?Ticks:StyleParam.TickOptions * ?TickLen:int * ?TickWidth:int * ?TickColor:string * ?ShowTickLabels:bool * ?ShowTickPrefix:StyleParam.ShowTickOption * ?TickPrefix:string * ?ShowTickSuffix:StyleParam.ShowTickOption * ?TickSuffix:string * ?ShowExponent:StyleParam.ShowExponent * ?ExponentFormat:StyleParam.ExponentFormat * ?MinExponent:float * ?SeparateThousands:bool * ?TickFont:Font * ?TickAngle:int * ?TickFormat:string * ?TickFormatStops:seq<TickFormatStop> * ?Layer:StyleParam.Layer -> Axis.AngularAxis
module StyleParam from Plotly.NET
type CategoryOrder = | Trace | CategoryAscending | CategoryDescending | Array | TotalAscending | TotalDescending | MinAscending | MinDescending | MaxAscending | MaxDescending ... static member convert : (CategoryOrder -> obj) static member toString : (CategoryOrder -> string)
<summary> Specifies the ordering logic for the case of categorical variables. By default, plotly uses "trace", which specifies the order that is present in the data supplied. Set `categoryorder` to "category ascending" or "category descending" if order should be determined by the alphanumerical order of the category names. Set `categoryorder` to "array" to derive the ordering from the attribute `categoryarray`. If a category is not found in the `categoryarray` array, the sorting behavior for that attribute will be identical to the "trace" mode. The unspecified categories will follow the categories in `categoryarray`. Set `categoryorder` to "total ascending" or "total descending" if order should be determined by the numerical order of the values. Similarly, the order can be determined by the min, max, sum, mean or median of all the values. </summary>
union case StyleParam.CategoryOrder.Array: StyleParam.CategoryOrder
module GenericChart from Plotly.NET
<summary> Module to represent a GenericChart </summary>
val toChartHTML : gChart:GenericChart.GenericChart -> string
<summary> Converts a GenericChart to it HTML representation. The div layer has a default size of 600 if not specified otherwise. </summary>