# Polar bar charts

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.

open Plotly.NET.LayoutObjects

let windrose1 =

[ Chart.BarPolar(r = r, theta = t, Name = "11-14 m/s", MarkerPatternShape = StyleParam.PatternShape.Checked)
Chart.BarPolar(r = r2, theta = t, Name = "8-11 m/s", MarkerPatternShape = StyleParam.PatternShape.DiagonalChecked)
Chart.BarPolar(r = r3, theta = t, Name = "5-8 m/s", MarkerPatternShape = StyleParam.PatternShape.VerticalLines)
Chart.BarPolar(r = r4, theta = 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
)
)

namespace Plotly
namespace Plotly.NET
module Defaults from Plotly.NET
<summary> Contains mutable global default values. Changing these values will apply the default values to all consecutive Chart generations. </summary>
val mutable DefaultDisplayOptions: DisplayOptions
Multiple items
type DisplayOptions = inherit DynamicObj new: unit -> DisplayOptions static member addAdditionalHeadTags: additionalHeadTags: XmlNode list -> (DisplayOptions -> DisplayOptions) static member addDescription: description: XmlNode list -> (DisplayOptions -> DisplayOptions) static member combine: first: DisplayOptions -> second: DisplayOptions -> DisplayOptions static member getAdditionalHeadTags: displayOpts: DisplayOptions -> XmlNode list static member getDescription: displayOpts: DisplayOptions -> XmlNode list static member getPlotlyReference: displayOpts: DisplayOptions -> PlotlyJSReference static member init: ?AdditionalHeadTags: XmlNode list * ?Description: XmlNode list * ?PlotlyJSReference: PlotlyJSReference -> DisplayOptions static member initCDNOnly: unit -> DisplayOptions ...

--------------------
new: unit -> DisplayOptions
static member DisplayOptions.init: ?AdditionalHeadTags: Giraffe.ViewEngine.HtmlElements.XmlNode list * ?Description: Giraffe.ViewEngine.HtmlElements.XmlNode list * ?PlotlyJSReference: PlotlyJSReference -> DisplayOptions
type PlotlyJSReference = | CDN of string | Full | Require of string | NoReference
<summary> Sets how plotly is referenced in the head of html docs. </summary>
union case PlotlyJSReference.NoReference: PlotlyJSReference
val r: float list
val r2: float list
val r3: float list
val r4: float list
val t: string list
namespace Plotly.NET.LayoutObjects
val windrose1: GenericChart.GenericChart
type Chart = static member AnnotatedHeatmap: zData: seq<#seq<'a1>> * annotationText: seq<#seq<string>> * ?Name: string * ?ShowLegend: bool * ?Opacity: float * ?X: seq<'a3> * ?MultiX: seq<seq<'a3>> * ?XGap: int * ?Y: seq<'a4> * ?MultiY: seq<seq<'a4>> * ?YGap: int * ?Text: 'a5 * ?MultiText: seq<'a5> * ?ColorBar: ColorBar * ?ColorScale: Colorscale * ?ShowScale: bool * ?ReverseScale: bool * ?ZSmooth: SmoothAlg * ?Transpose: bool * ?UseWebGL: bool * ?ReverseYAxis: bool * ?UseDefaults: bool -> GenericChart (requires 'a1 :> IConvertible and 'a3 :> IConvertible and 'a4 :> IConvertible and 'a5 :> IConvertible) + 1 overload static member Area: x: seq<#IConvertible> * y: seq<#IConvertible> * ?ShowMarkers: bool * ?Name: string * ?ShowLegend: bool * ?Opacity: float * ?MultiOpacity: seq<float> * ?Text: 'a2 * ?MultiText: seq<'a2> * ?TextPosition: TextPosition * ?MultiTextPosition: seq<TextPosition> * ?MarkerColor: Color * ?MarkerColorScale: Colorscale * ?MarkerOutline: Line * ?MarkerSymbol: MarkerSymbol * ?MultiMarkerSymbol: seq<MarkerSymbol> * ?Marker: Marker * ?LineColor: Color * ?LineColorScale: Colorscale * ?LineWidth: float * ?LineDash: DrawingStyle * ?Line: Line * ?AlignmentGroup: string * ?OffsetGroup: string * ?StackGroup: string * ?Orientation: Orientation * ?GroupNorm: GroupNorm * ?FillColor: Color * ?FillPatternShape: PatternShape * ?FillPattern: Pattern * ?UseWebGL: bool * ?UseDefaults: bool -> GenericChart (requires 'a2 :> IConvertible) + 1 overload static member Bar: values: seq<#IConvertible> * ?Keys: seq<'a1> * ?MultiKeys: seq<seq<'a1>> * ?Name: string * ?ShowLegend: bool * ?Opacity: float * ?MultiOpacity: seq<float> * ?Text: 'a2 * ?MultiText: seq<'a2> * ?MarkerColor: Color * ?MarkerColorScale: Colorscale * ?MarkerOutline: Line * ?MarkerPatternShape: PatternShape * ?MultiMarkerPatternShape: seq<PatternShape> * ?MarkerPattern: Pattern * ?Marker: Marker * ?Base: #IConvertible * ?Width: 'a4 * ?MultiWidth: seq<'a4> * ?TextPosition: TextPosition * ?MultiTextPosition: seq<TextPosition> * ?UseDefaults: bool -> GenericChart (requires 'a1 :> IConvertible and 'a2 :> IConvertible and 'a4 :> IConvertible) + 1 overload static member BoxPlot: ?X: seq<'a0> * ?MultiX: seq<seq<'a0>> * ?Y: seq<'a1> * ?MultiY: seq<seq<'a1>> * ?Name: string * ?ShowLegend: bool * ?Text: 'a2 * ?MultiText: seq<'a2> * ?FillColor: Color * ?MarkerColor: Color * ?Marker: Marker * ?Opacity: float * ?WhiskerWidth: float * ?BoxPoints: BoxPoints * ?BoxMean: BoxMean * ?Jitter: float * ?PointPos: float * ?Orientation: Orientation * ?OutlineColor: Color * ?OutlineWidth: float * ?Outline: Line * ?AlignmentGroup: string * ?OffsetGroup: string * ?Notched: bool * ?NotchWidth: float * ?QuartileMethod: QuartileMethod * ?UseDefaults: bool -> GenericChart (requires 'a0 :> IConvertible and 'a1 :> IConvertible and 'a2 :> IConvertible) + 2 overloads static member Bubble: x: seq<#IConvertible> * y: seq<#IConvertible> * sizes: seq<int> * ?Name: string * ?ShowLegend: bool * ?Opacity: float * ?MultiOpacity: seq<float> * ?Text: 'a2 * ?MultiText: seq<'a2> * ?TextPosition: TextPosition * ?MultiTextPosition: seq<TextPosition> * ?MarkerColor: Color * ?MarkerColorScale: Colorscale * ?MarkerOutline: Line * ?MarkerSymbol: MarkerSymbol * ?MultiMarkerSymbol: seq<MarkerSymbol> * ?Marker: Marker * ?LineColor: Color * ?LineColorScale: Colorscale * ?LineWidth: float * ?LineDash: DrawingStyle * ?Line: Line * ?AlignmentGroup: string * ?OffsetGroup: string * ?StackGroup: string * ?Orientation: Orientation * ?GroupNorm: GroupNorm * ?UseWebGL: bool * ?UseDefaults: bool -> GenericChart (requires 'a2 :> IConvertible) + 1 overload static member Candlestick: open : seq<#IConvertible> * high: seq<#IConvertible> * low: seq<#IConvertible> * close: seq<#IConvertible> * ?X: seq<'a4> * ?MultiX: seq<seq<'a4>> * ?Name: string * ?ShowLegend: bool * ?Opacity: float * ?Text: 'a5 * ?MultiText: seq<'a5> * ?Line: Line * ?IncreasingColor: Color * ?Increasing: FinanceMarker * ?DecreasingColor: Color * ?Decreasing: FinanceMarker * ?WhiskerWidth: float * ?ShowXAxisRangeSlider: bool * ?UseDefaults: bool -> GenericChart (requires 'a4 :> IConvertible and 'a5 :> IConvertible) + 2 overloads static member Column: values: seq<#IConvertible> * ?Keys: seq<'a1> * ?MultiKeys: seq<seq<'a1>> * ?Name: string * ?ShowLegend: bool * ?Opacity: float * ?MultiOpacity: seq<float> * ?Text: 'a2 * ?MultiText: seq<'a2> * ?MarkerColor: Color * ?MarkerColorScale: Colorscale * ?MarkerOutline: Line * ?MarkerPatternShape: PatternShape * ?MultiMarkerPatternShape: seq<PatternShape> * ?MarkerPattern: Pattern * ?Marker: Marker * ?Base: #IConvertible * ?Width: 'a4 * ?MultiWidth: seq<'a4> * ?TextPosition: TextPosition * ?MultiTextPosition: seq<TextPosition> * ?UseDefaults: bool -> GenericChart (requires 'a1 :> IConvertible and 'a2 :> IConvertible and 'a4 :> IConvertible) + 1 overload static member Contour: zData: seq<#seq<'a1>> * ?Name: string * ?ShowLegend: bool * ?Opacity: float * ?X: seq<'a2> * ?MultiX: seq<seq<'a2>> * ?Y: seq<'a3> * ?MultiY: seq<seq<'a3>> * ?Text: 'a4 * ?MultiText: seq<'a4> * ?ColorBar: ColorBar * ?ColorScale: Colorscale * ?ShowScale: bool * ?ReverseScale: bool * ?Transpose: bool * ?ContourLineColor: Color * ?ContourLineDash: DrawingStyle * ?ContourLineSmoothing: float * ?ContourLine: Line * ?ContoursColoring: ContourColoring * ?ContoursOperation: ConstraintOperation * ?ContoursType: ContourType * ?ShowContourLabels: bool * ?ContourLabelFont: Font * ?Contours: Contours * ?FillColor: Color * ?NContours: int * ?UseDefaults: bool -> GenericChart (requires 'a1 :> IConvertible and 'a2 :> IConvertible and 'a3 :> IConvertible and 'a4 :> IConvertible) static member Funnel: x: seq<#IConvertible> * y: seq<#IConvertible> * ?Name: string * ?ShowLegend: bool * ?Opacity: float * ?Width: float * ?Offset: float * ?Text: 'a2 * ?MultiText: seq<'a2> * ?TextPosition: TextPosition * ?MultiTextPosition: seq<TextPosition> * ?Orientation: Orientation * ?AlignmentGroup: string * ?OffsetGroup: string * ?MarkerColor: Color * ?MarkerOutline: Line * ?Marker: Marker * ?TextInfo: TextInfo * ?ConnectorLineColor: Color * ?ConnectorLineStyle: DrawingStyle * ?ConnectorFillColor: Color * ?ConnectorLine: Line * ?Connector: FunnelConnector * ?InsideTextFont: Font * ?OutsideTextFont: Font * ?UseDefaults: bool -> GenericChart (requires 'a2 :> IConvertible) static member Heatmap: zData: seq<#seq<'a1>> * ?X: seq<'a2> * ?MultiX: seq<seq<'a2>> * ?Y: seq<'a3> * ?MultiY: seq<seq<'a3>> * ?Name: string * ?ShowLegend: bool * ?Opacity: float * ?XGap: int * ?YGap: int * ?Text: 'a4 * ?MultiText: seq<'a4> * ?ColorBar: ColorBar * ?ColorScale: Colorscale * ?ShowScale: bool * ?ReverseScale: bool * ?ZSmooth: SmoothAlg * ?Transpose: bool * ?UseWebGL: bool * ?ReverseYAxis: bool * ?UseDefaults: bool -> GenericChart (requires 'a1 :> IConvertible and 'a2 :> IConvertible and 'a3 :> IConvertible and 'a4 :> IConvertible) + 1 overload ...
static member Chart.BarPolar: rTheta: seq<#System.IConvertible * #System.IConvertible> * ?Name: string * ?ShowLegend: bool * ?Opacity: float * ?MultiOpacity: seq<float> * ?Text: 'a2 * ?MultiText: seq<'a2> * ?MarkerColor: Color * ?MarkerColorScale: StyleParam.Colorscale * ?MarkerOutline: Line * ?MarkerPatternShape: StyleParam.PatternShape * ?MultiMarkerPatternShape: seq<StyleParam.PatternShape> * ?MarkerPattern: TraceObjects.Pattern * ?Marker: TraceObjects.Marker * ?Base: #System.IConvertible * ?Width: 'a4 * ?MultiWidth: seq<'a4> * ?UseDefaults: bool -> GenericChart.GenericChart (requires 'a2 :> System.IConvertible and 'a4 :> System.IConvertible)
static member Chart.BarPolar: r: seq<#System.IConvertible> * theta: seq<#System.IConvertible> * ?Name: string * ?ShowLegend: bool * ?Opacity: float * ?MultiOpacity: seq<float> * ?Text: 'c * ?MultiText: seq<'c> * ?MarkerColor: Color * ?MarkerColorScale: StyleParam.Colorscale * ?MarkerOutline: Line * ?MarkerPatternShape: StyleParam.PatternShape * ?MultiMarkerPatternShape: seq<StyleParam.PatternShape> * ?MarkerPattern: TraceObjects.Pattern * ?Marker: TraceObjects.Marker * ?Base: #System.IConvertible * ?Width: 'e * ?MultiWidth: seq<'e> * ?UseDefaults: bool -> GenericChart.GenericChart (requires 'c :> System.IConvertible and 'e :> System.IConvertible)
argument r: seq<float>
<summary> Creates a polar bar chart. A polar bar chart is a chart that presents categorical data on a polar coordinate system with bars with radial height proportional to the values that they represent. </summary>
<param name="r">Sets the radial height of the bars</param>
<param name="theta">sets the angular position of the bars</param>
<param name="Name">Sets the trace name. The trace name appear as the legend item and on hover</param>
<param name="ShowLegend">Determines whether or not an item corresponding to this trace is shown in the legend.</param>
<param name="Opacity">Sets the opactity of the trace</param>
<param name="MultiOpacity">Sets the opactity of individual datum markers</param>
<param name="Text">Sets a text associated with each datum</param>
<param name="MultiText">Sets individual text for each datum</param>
<param name="MarkerColor">Sets the color of the bars</param>
<param name="MarkerColorScale">Sets the colorscale of the bars</param>
<param name="MarkerOutline">Sets the color of the bar outline</param>
<param name="MarkerPatternShape">Sets the pattern shape for all bars</param>
<param name="MultiMarkerPatternShape">Sets individual pattern shapes for the bars</param>
<param name="MarkerPattern">Sets the marker pattern (use this for more finegrained control than the other pattern-associated arguments).</param>
<param name="Marker">Sets the marker for the bars (use this for more finegrained control than the other marker-associated arguments).</param>
<param name="Base">Sets where the bar base is drawn (in position axis units).</param>
<param name="Width">Sets the bar width (in position axis units) of all bars.</param>
<param name="MultiWidth">Sets the individual bar width (in position axis units) for each bar.</param>
<param name="UseDefaults">If set to false, ignore the global default settings set in Defaults</param>
module StyleParam from Plotly.NET
type PatternShape = | None | DiagonalDescending | DiagonalAscending | DiagonalChecked | HorizontalLines | VerticalLines | Checked | Dots member Convert: unit -> obj override ToString: unit -> string static member convert: (PatternShape -> obj) static member toString: (PatternShape -> string)
union case StyleParam.PatternShape.Checked: StyleParam.PatternShape
union case StyleParam.PatternShape.DiagonalChecked: StyleParam.PatternShape
union case StyleParam.PatternShape.VerticalLines: StyleParam.PatternShape
union case StyleParam.PatternShape.HorizontalLines: StyleParam.PatternShape
static member Chart.combine: gCharts: seq<GenericChart.GenericChart> -> GenericChart.GenericChart
static member Chart.withAngularAxis: angularAxis: AngularAxis * ?Id: int -> (GenericChart.GenericChart -> GenericChart.GenericChart)
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: Color * ?ShowLine: bool * ?LineColor: Color * ?LineWidth: int * ?ShowGrid: bool * ?GridColor: Color * ?GridDash: DrawingStyle * ?GridWidth: int * ?TickMode: TickMode * ?NTicks: int * ?Tick0: #IConvertible * ?DTick: #IConvertible * ?TickVals: seq<#IConvertible> * ?TickText: seq<#IConvertible> * ?Ticks: TickOptions * ?TickLen: int * ?TickWidth: int * ?TickColor: Color * ?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> * ?TickLabelStep: int * ?LabelAlias: DynamicObj * ?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: Color * ?ShowLine: bool * ?LineColor: Color * ?LineWidth: int * ?ShowGrid: bool * ?GridColor: Color * ?GridDash: DrawingStyle * ?GridWidth: int * ?TickMode: TickMode * ?NTicks: int * ?Tick0: #IConvertible * ?DTick: #IConvertible * ?TickVals: seq<#IConvertible> * ?TickText: seq<#IConvertible> * ?Ticks: TickOptions * ?TickLen: int * ?TickWidth: int * ?TickColor: Color * ?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> * ?TickLabelStep: int * ?LabelAlias: DynamicObj * ?Layer: Layer -> (AngularAxis -> AngularAxis)
<summary>Angular axes can be used as a scale for the angular coordinates in polar plots.</summary>

--------------------
new: unit -> AngularAxis
static member 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: Color * ?ShowLine: bool * ?LineColor: Color * ?LineWidth: int * ?ShowGrid: bool * ?GridColor: Color * ?GridDash: StyleParam.DrawingStyle * ?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: Color * ?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> * ?TickLabelStep: int * ?LabelAlias: DynamicObj.DynamicObj * ?Layer: StyleParam.Layer -> AngularAxis
type CategoryOrder = | Trace | CategoryAscending | CategoryDescending | Array | TotalAscending | TotalDescending | MinAscending | MinDescending | MaxAscending | MaxDescending ... member Convert: unit -> obj override ToString: unit -> string 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