Summary: This example shows how to create choropleth maps using Mapbox layers in F#.
Choropleth Maps display divided geographical areas or regions that are coloured, shaded or patterned in relation to
a data variable. This provides a way to visualise values over a geographical area, which can show variation or
patterns across the displayed location.
This choropleth map version uses Mapbox Layers. For the Geo variant, head over here.
ChoroplethMapbox charts need GeoJSON formatted data.
GeoJSON is an open standard format designed for representing simple geographical features, along with their non-spatial attributes.
GeoJSON, or at least the type of GeoJSON accepted by plotly.js are FeatureCollection
s. A feature has for example the geometry
field, which defines e.g. the coordinates of it (think for example the coordinates of a polygon on the map)
and the properties
field, a key-value pair of properties of the feature.
If you want to use GeoJSON with Plotly.NET (or any plotly flavor really), you have to know the property of the feature you are mapping your data to. In the following example, this is simply the id
of a feature, but you can access any property by property.key
.
Consider the following GeoJSON:
// we are using the awesome FSharp.Data project here to perform a http request
open Newtonsoft.Json
open System.IO
let geoJson =
(__SOURCE_DIRECTORY__ + "/../data/geojson-counties-fips.json")
|> File.ReadAllText
|> JsonConvert.DeserializeObject // the easiest way to use the GeoJSON object is deserializing the JSON string.
it looks like this:
{
"type": "FeatureCollection",
"features": [{
"type": "Feature",
"properties": {
"GEO_ID": "0500000US01001",
"STATE": "01",
"COUNTY": "001",
"NAME": "Autauga",
"LSAD": "County",
"CENSUSAREA": 594.436
},
"geometry": {
"type": "Polygon",
"coordinates": [[[-86.496774, 32.344437], [-86.717897, 32.402814], [-86.814912, 32.340803], [-86.890581, 32.502974], [-86.917595, 32.664169], [-86.71339, 32.661732], [-86.714219, 32.705694], [-86.413116, 32.707386], [-86.411172, 32.409937], [-86.496774, 32.344437]]]
},
"id": "01001"
}, ... MANY more features.
|
It basically contains all US counties as polygons on the map. Note that the id
property corresponds to the fips code.
To visualize some data using these counties as locations on a choropleth map, we need some example data:
// we use the awesome Deedle data frame library to parse and extract our location and z data
open Deedle
let data =
__SOURCE_DIRECTORY__ + "/../data/fips-unemp-16.csv"
|> fun csv -> Frame.ReadCsv(csv, true, separators = ",", schema = "fips=string,unemp=float")
The data looks like this:
data.Print()
fips unemp
0 -> 01001 5.3
1 -> 01003 5.4
2 -> 01005 8.6
3 -> 01007 6.6
4 -> 01009 5.5
5 -> 01011 7.2
6 -> 01013 7.1
7 -> 01015 6.7
8 -> 01017 5.5
9 -> 01019 5.2
10 -> 01021 5.6
11 -> 01023 8.9
12 -> 01025 11.1
13 -> 01027 6.2
14 -> 01029 6.1
: ... ...
3204 -> 72125 15.1
3205 -> 72127 7.9
3206 -> 72129 12.6
3207 -> 72131 18.9
3208 -> 72133 16.8
3209 -> 72135 8.4
3210 -> 72137 8.9
3211 -> 72139 7.2
3212 -> 72141 15.5
3213 -> 72143 11.6
3214 -> 72145 13.9
3215 -> 72147 10.6
3216 -> 72149 20.2
3217 -> 72151 16.9
3218 -> 72153 18.8
|
As the data contains the fips code and associated unemployment data, we can use the fips codes as locations and the unemployment as z data:
let locations: string[] =
data |> Frame.getCol "fips" |> Series.values |> Array.ofSeq
let z: int[] = data |> Frame.getCol "unemp" |> Series.values |> Array.ofSeq
And finally put together the chart using GeoJSON:
open Plotly.NET
open Plotly.NET.LayoutObjects
let choroplethMapbox =
Chart.ChoroplethMapbox(locations = locations, z = z, geoJson = geoJson, FeatureIdKey = "id")
|> Chart.withMapbox (
Mapbox.init (
Style = StyleParam.MapboxStyle.OpenStreetMap, // Use the free open street map base map layer
Center = (-104.6, 50.45)
)
)
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
namespace Newtonsoft
namespace Newtonsoft.Json
namespace System
namespace System.IO
val geoJson: obj
type File =
static member AppendAllLines: path: string * contents: IEnumerable<string> -> unit + 1 overload
static member AppendAllLinesAsync: path: string * contents: IEnumerable<string> * encoding: Encoding * ?cancellationToken: CancellationToken -> Task + 1 overload
static member AppendAllText: path: string * contents: string -> unit + 1 overload
static member AppendAllTextAsync: path: string * contents: string * encoding: Encoding * ?cancellationToken: CancellationToken -> Task + 1 overload
static member AppendText: path: string -> StreamWriter
static member Copy: sourceFileName: string * destFileName: string -> unit + 1 overload
static member Create: path: string -> FileStream + 2 overloads
static member CreateSymbolicLink: path: string * pathToTarget: string -> FileSystemInfo
static member CreateText: path: string -> StreamWriter
static member Decrypt: path: string -> unit
...
<summary>Provides static methods for the creation, copying, deletion, moving, and opening of a single file, and aids in the creation of <see cref="T:System.IO.FileStream" /> objects.</summary>
File.ReadAllText(path: string) : string
File.ReadAllText(path: string, encoding: System.Text.Encoding) : string
type JsonConvert =
static member DeserializeAnonymousType<'T> : value: string * anonymousTypeObject: 'T -> 'T + 1 overload
static member DeserializeObject: value: string -> obj + 7 overloads
static member DeserializeXNode: value: string -> XDocument + 3 overloads
static member DeserializeXmlNode: value: string -> XmlDocument + 3 overloads
static member PopulateObject: value: string * target: obj -> unit + 1 overload
static member SerializeObject: value: obj -> string + 7 overloads
static member SerializeXNode: node: XObject -> string + 2 overloads
static member SerializeXmlNode: node: XmlNode -> string + 2 overloads
static member ToString: value: DateTime -> string + 24 overloads
static val False: string
...
<summary>
Provides methods for converting between .NET types and JSON types.
</summary>
<example><code lang="cs" source="..\Src\Newtonsoft.Json.Tests\Documentation\SerializationTests.cs" region="SerializeObject" title="Serializing and Deserializing JSON with JsonConvert" /></example>
JsonConvert.DeserializeObject<'T>(value: string) : 'T
JsonConvert.DeserializeObject(value: string) : obj
JsonConvert.DeserializeObject<'T>(value: string, settings: JsonSerializerSettings) : 'T
JsonConvert.DeserializeObject<'T>(value: string, [<System.ParamArray>] converters: JsonConverter[]) : 'T
JsonConvert.DeserializeObject(value: string, ``type`` : System.Type) : obj
JsonConvert.DeserializeObject(value: string, settings: JsonSerializerSettings) : obj
JsonConvert.DeserializeObject(value: string, ``type`` : System.Type, settings: JsonSerializerSettings) : obj
JsonConvert.DeserializeObject(value: string, ``type`` : System.Type, [<System.ParamArray>] converters: JsonConverter[]) : obj
namespace Deedle
val data: Frame<int,string>
val csv: string
Multiple items
module Frame
from Deedle
--------------------
type Frame =
static member ReadCsv: location: string * hasHeaders: Nullable<bool> * inferTypes: Nullable<bool> * inferRows: Nullable<int> * schema: string * separators: string * culture: string * maxRows: Nullable<int> * missingValues: string[] * preferOptions: bool -> Frame<int,string> + 1 overload
static member ReadReader: reader: IDataReader -> Frame<int,string>
static member CustomExpanders: Dictionary<Type,Func<obj,seq<string * Type * obj>>>
static member NonExpandableInterfaces: ResizeArray<Type>
static member NonExpandableTypes: HashSet<Type>
--------------------
type Frame<'TRowKey,'TColumnKey (requires equality and equality)> =
interface IDynamicMetaObjectProvider
interface INotifyCollectionChanged
interface IFrameFormattable
interface IFsiFormattable
interface IFrame
new: rowIndex: IIndex<'TRowKey> * columnIndex: IIndex<'TColumnKey> * data: IVector<IVector> * indexBuilder: IIndexBuilder * vectorBuilder: IVectorBuilder -> Frame<'TRowKey,'TColumnKey> + 1 overload
member AddColumn: column: 'TColumnKey * series: seq<'V> -> unit + 3 overloads
member AggregateRowsBy: groupBy: seq<'TColumnKey> * aggBy: seq<'TColumnKey> * aggFunc: Func<Series<'TRowKey,'a>,'b> -> Frame<int,'TColumnKey>
member Clone: unit -> Frame<'TRowKey,'TColumnKey>
member ColumnApply: f: Func<Series<'TRowKey,'T>,ISeries<'TRowKey>> -> Frame<'TRowKey,'TColumnKey> + 1 overload
...
--------------------
new: names: seq<'TColumnKey> * columns: seq<ISeries<'TRowKey>> -> Frame<'TRowKey,'TColumnKey>
new: rowIndex: Indices.IIndex<'TRowKey> * columnIndex: Indices.IIndex<'TColumnKey> * data: IVector<IVector> * indexBuilder: Indices.IIndexBuilder * vectorBuilder: Vectors.IVectorBuilder -> Frame<'TRowKey,'TColumnKey>
static member Frame.ReadCsv: path: string * ?hasHeaders: bool * ?inferTypes: bool * ?inferRows: int * ?schema: string * ?separators: string * ?culture: string * ?maxRows: int * ?missingValues: string[] * ?preferOptions: bool -> Frame<int,string>
static member Frame.ReadCsv: stream: Stream * ?hasHeaders: bool * ?inferTypes: bool * ?inferRows: int * ?schema: string * ?separators: string * ?culture: string * ?maxRows: int * ?missingValues: string[] * ?preferOptions: bool -> Frame<int,string>
static member Frame.ReadCsv: reader: TextReader * ?hasHeaders: bool * ?inferTypes: bool * ?inferRows: int * ?schema: string * ?separators: string * ?culture: string * ?maxRows: int * ?missingValues: string[] * ?preferOptions: bool -> Frame<int,string>
static member Frame.ReadCsv: stream: Stream * hasHeaders: System.Nullable<bool> * inferTypes: System.Nullable<bool> * inferRows: System.Nullable<int> * schema: string * separators: string * culture: string * maxRows: System.Nullable<int> * missingValues: string[] * preferOptions: System.Nullable<bool> -> Frame<int,string>
static member Frame.ReadCsv: location: string * hasHeaders: System.Nullable<bool> * inferTypes: System.Nullable<bool> * inferRows: System.Nullable<int> * schema: string * separators: string * culture: string * maxRows: System.Nullable<int> * missingValues: string[] * preferOptions: bool -> Frame<int,string>
static member Frame.ReadCsv: path: string * indexCol: string * ?hasHeaders: bool * ?inferTypes: bool * ?inferRows: int * ?schema: string * ?separators: string * ?culture: string * ?maxRows: int * ?missingValues: string[] * ?preferOptions: bool -> Frame<'R,string> (requires equality)
static member FrameExtensions.Print: frame: Frame<'K,'V> -> unit (requires equality and equality)
static member FrameExtensions.Print: frame: Frame<'K,'V> * printTypes: bool -> unit (requires equality and equality)
val locations: string[]
Multiple items
val string: value: 'T -> string
<summary>Converts the argument to a string using <c>ToString</c>.</summary>
<remarks>For standard integer and floating point values the and any type that implements <c>IFormattable</c><c>ToString</c> conversion uses <c>CultureInfo.InvariantCulture</c>. </remarks>
<param name="value">The input value.</param>
<returns>The converted string.</returns>
<example id="string-example"><code lang="fsharp"></code></example>
--------------------
type string = System.String
<summary>An abbreviation for the CLI type <see cref="T:System.String" />.</summary>
<category>Basic Types</category>
val getCol: column: 'C -> frame: Frame<'R,'C> -> Series<'R,'V> (requires equality and equality)
Multiple items
module Series
from Deedle
--------------------
type Series =
static member ofNullables: values: seq<Nullable<'a0>> -> Series<int,'a0> (requires default constructor and value type and 'a0 :> ValueType)
static member ofObservations: observations: seq<'c * 'd> -> Series<'c,'d> (requires equality)
static member ofOptionalObservations: observations: seq<'K * 'a1 option> -> Series<'K,'a1> (requires equality)
static member ofValues: values: seq<'a> -> Series<int,'a>
--------------------
type Series<'K,'V (requires equality)> =
interface ISeriesFormattable
interface IFsiFormattable
interface ISeries<'K>
new: index: IIndex<'K> * vector: IVector<'V> * vectorBuilder: IVectorBuilder * indexBuilder: IIndexBuilder -> Series<'K,'V> + 3 overloads
member After: lowerExclusive: 'K -> Series<'K,'V>
member Aggregate: aggregation: Aggregation<'K> * keySelector: Func<DataSegment<Series<'K,'V>>,'TNewKey> * valueSelector: Func<DataSegment<Series<'K,'V>>,OptionalValue<'R>> -> Series<'TNewKey,'R> (requires equality) + 1 overload
member AsyncMaterialize: unit -> Async<Series<'K,'V>>
member Before: upperExclusive: 'K -> Series<'K,'V>
member Between: lowerInclusive: 'K * upperInclusive: 'K -> Series<'K,'V>
member Compare: another: Series<'K,'V> -> Series<'K,Diff<'V>>
...
--------------------
new: pairs: seq<System.Collections.Generic.KeyValuePair<'K,'V>> -> Series<'K,'V>
new: keys: seq<'K> * values: seq<'V> -> Series<'K,'V>
new: keys: 'K[] * values: 'V[] -> Series<'K,'V>
new: index: Indices.IIndex<'K> * vector: IVector<'V> * vectorBuilder: Vectors.IVectorBuilder * indexBuilder: Indices.IIndexBuilder -> Series<'K,'V>
val values: series: Series<'K,'T> -> seq<'T> (requires equality)
module Array
from Microsoft.FSharp.Collections
<summary>Contains operations for working with arrays.</summary>
<remarks>
See also <a href="https://docs.microsoft.com/dotnet/fsharp/language-reference/arrays">F# Language Guide - Arrays</a>.
</remarks>
val ofSeq: source: seq<'T> -> 'T[]
<summary>Builds a new array from the given enumerable object.</summary>
<param name="source">The input sequence.</param>
<returns>The array of elements from the sequence.</returns>
<exception cref="T:System.ArgumentNullException">Thrown when the input sequence is null.</exception>
<example id="ofseq-1"><code lang="fsharp">
let inputs = seq { 1; 2; 5 }
inputs |> Array.ofSeq
</code>
Evaluates to <c>[| 1; 2; 5 |]</c>.
</example>
val z: int[]
Multiple items
val int: value: 'T -> int (requires member op_Explicit)
<summary>Converts the argument to signed 32-bit integer. This is a direct conversion for all
primitive numeric types. For strings, the input is converted using <c>Int32.Parse()</c>
with InvariantCulture settings. Otherwise the operation requires an appropriate
static conversion method on the input type.</summary>
<param name="value">The input value.</param>
<returns>The converted int</returns>
<example id="int-example"><code lang="fsharp"></code></example>
--------------------
[<Struct>]
type int = int32
<summary>An abbreviation for the CLI type <see cref="T:System.Int32" />.</summary>
<category>Basic Types</category>
--------------------
type int<'Measure> =
int
<summary>The type of 32-bit signed integer numbers, annotated with a unit of measure. The unit
of measure is erased in compiled code and when values of this type
are analyzed using reflection. The type is representationally equivalent to
<see cref="T:System.Int32" />.</summary>
<category>Basic Types with Units of Measure</category>
namespace Plotly.NET.LayoutObjects
val choroplethMapbox: 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.ChoroplethMapbox: locations: seq<string> * z: seq<#System.IConvertible> * geoJson: obj * ?Name: string * ?MapboxStyle: StyleParam.MapboxStyle * ?ShowLegend: bool * ?FeatureIdKey: string * ?Text: 'b * ?MultiText: seq<'b> * ?ColorBar: ColorBar * ?ColorScale: StyleParam.Colorscale * ?ShowScale: bool * ?ReverseScale: bool * ?Below: string * ?UseDefaults: bool -> GenericChart.GenericChart (requires 'b :> System.IConvertible)
argument z: seq<int>
<summary>
Creates a choropleth map using mapbox.
A choropleth map is a type of thematic map in which a set of pre-defined areas is colored or patterned in proportion to a statistical variable that represents an aggregate summary of a geographic characteristic within each area, such as population density or per-capita income.
GeoJSON features to be filled are set in `geojson` The data that describes the choropleth value-to-color mapping is set in `locations` and `z`.
Customize the mapbox layers, style, etc. by using Chart.withMapbox.
You might need a Mapbox token, which you can also configure with Chart.withMapbox.
</summary>
<param name="locations">Sets the coordinates via location IDs or names. Coordinates correspond to the centroid of each location given. See `locationmode` for more info.</param>
<param name="z">The color values for each location</param>
<param name="geoJson">Sets the GeoJSON data associated with this trace. It can be set as a valid GeoJSON object or as a URL string. Note that we only accept GeoJSONs of type "FeatureCollection" or "Feature" with geometries of type "Polygon" or "MultiPolygon".</param>
<param name="Name">Sets the trace name. The trace name appear as the legend item and on hover.</param>
<param name="MapboxStyle">Sets the base mapbox layer. Default is `OpenStreetMap`. Note that you will need an access token for some Mapbox presets.</param>
<param name="ShowLegend">Determines whether or not an item corresponding to this trace is shown in the legend.</param>
<param name="FeatureIdKey">Sets the key in GeoJSON features which is used as id to match the items included in the `locations` array. Support nested property, for example "properties.name".</param>
<param name="Text">Sets a text associated with each datum</param>
<param name="MultiText">Sets individual text for each datum</param>
<param name="ColorBar">Sets the colorbar.</param>
<param name="ColorScale">Sets the colorscale.</param>
<param name="ShowScale">Determines whether or not a colorbar is displayed for this trace.</param>
<param name="ReverseScale">Reverses the color mapping if true.</param>
<param name="Below">Determines if this scattermapbox trace's layers are to be inserted before the layer with the specified ID. By default, scattermapbox layers are inserted above all the base layers. To place the scattermapbox layers above every other layer, set `below` to "''".</param>
<param name="UseDefaults">If set to false, ignore the global default settings set in `Defaults`</param>
static member Chart.withMapbox: mapbox: Mapbox * ?Id: int -> (GenericChart.GenericChart -> GenericChart.GenericChart)
Multiple items
type Mapbox =
inherit DynamicObj
new: unit -> Mapbox
static member init: ?Domain: Domain * ?AccessToken: string * ?Style: MapboxStyle * ?Bounds: MapboxBounds * ?Center: (float * float) * ?Zoom: float * ?Bearing: float * ?Pitch: float * ?Layers: seq<MapboxLayer> -> Mapbox
static member style: ?Domain: Domain * ?AccessToken: string * ?Style: MapboxStyle * ?Bounds: MapboxBounds * ?Center: (float * float) * ?Zoom: float * ?Bearing: float * ?Pitch: float * ?Layers: seq<MapboxLayer> -> (Mapbox -> Mapbox)
<summary>Determines the style of the map shown in mapbox traces</summary>
--------------------
new: unit -> Mapbox
static member Mapbox.init: ?Domain: Domain * ?AccessToken: string * ?Style: StyleParam.MapboxStyle * ?Bounds: MapboxBounds * ?Center: (float * float) * ?Zoom: float * ?Bearing: float * ?Pitch: float * ?Layers: seq<MapboxLayer> -> Mapbox
module StyleParam
from Plotly.NET
type MapboxStyle =
| OpenStreetMap
| WhiteBG
| CartoPositron
| CartoDarkmatter
| StamenTerrain
| StamenToner
| StamenWatercolor
| MapboxBasic
| MapboxStreets
| MapboxOutdoors
...
member Convert: unit -> obj
override ToString: unit -> string
static member convert: (MapboxStyle -> obj)
static member toString: (MapboxStyle -> string)
<summary>
Defines the map layers that are rendered by default below the trace layers defined in `data`, which are themselves by default rendered below the layers defined in `layout.mapbox.layers`.
These layers can be defined either explicitly as a Mapbox Style object which can contain multiple layer definitions that load data from any public or private Tile Map Service (TMS or XYZ) or Web Map Service (WMS) or implicitly by using one of the built-in style objects which use WMSes which do not require any access tokens,
or by using a default Mapbox style or custom Mapbox style URL, both of which require a Mapbox access token Note that Mapbox access token can be set in the `accesstoken` attribute or in the `mapboxAccessToken` config option.
Mapbox Style objects are of the form described in the Mapbox GL JS documentation available at https://docs.mapbox.com/mapbox-gl-js/style-spec The built-in plotly.js styles objects are: open-street-map, white-bg, carto-positron, carto-darkmatter, stamen-terrain, stamen-toner, stamen-watercolor
The built-in Mapbox styles are: basic, streets, outdoors, light, dark, satellite, satellite-streets Mapbox style URLs are of the form: mapbox://mapbox.mapbox-<name>-<version>
</summary>
union case StyleParam.MapboxStyle.OpenStreetMap: StyleParam.MapboxStyle
module GenericChart
from Plotly.NET
<summary>
Module to represent a GenericChart
</summary>
val toChartHTML: gChart: GenericChart.GenericChart -> string