Repository navigation
Expand file tree
/
Copy pathHistogram2D.cs
More file actions
136 lines (133 loc) · 8.2 KB
/
Copy pathHistogram2D.cs
File metadata and controls
136 lines (133 loc) · 8.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
using System;
using System.Collections.Generic;
using Plotly.NET;
using Plotly.NET.LayoutObjects;
using Plotly.NET.TraceObjects;
using static Plotly.NET.StyleParam;
namespace Plotly.NET.CSharp;
public static partial class Chart
{
/// <summary>
/// Visualizes the distribution of the 2-dimensional input data as 2D Histogram.
///
///The sample data from which statistics are computed is set in `x` and `y` (where `x` and `y` represent marginal distributions, binning is set in `xbins` and `ybins` in this case) or `z` (where `z` represent the 2D distribution and binning set, binning is set by `x` and `y` in this case). The resulting distribution is visualized as a heatmap.
/// </summary>
/// <param name="x">Sets the sample data to be binned on the x axis.</param>
/// <param name="y">Sets the sample data to be binned on the y axis.</param>
/// <param name="Z">Sets the aggregation data.</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 Opacity of the trace.</param>
/// <param name="XGap">Sets the horizontal gap (in pixels) between bricks.</param>
/// <param name="YGap">Sets the vertical gap (in pixels) between bricks.</param>
/// <param name="HistFunc">Specifies the binning function used for this histogram trace. If "count", the histogram values are computed by counting the number of values lying inside each bin. If "sum", "avg", "min", "max", the histogram values are computed using the sum, the average, the minimum or the maximum of the values lying inside each bin respectively.</param>
/// <param name="HistNorm">Specifies the type of normalization used for this histogram trace. If "", the span of each bar corresponds to the number of occurrences (i.e. the number of data points lying inside the bins). If "percent" / "probability", the span of each bar corresponds to the percentage / fraction of occurrences with respect to the total number of sample points (here, the sum of all bin HEIGHTS equals 100% / 1). If "density", the span of each bar corresponds to the number of occurrences in a bin divided by the size of the bin interval (here, the sum of all bin AREAS equals the total number of sample points). If "probability density", the area of each bar corresponds to the probability that an event will fall into the corresponding bin (here, the sum of all bin AREAS equals 1).</param>
/// <param name="NBinsX">Specifies the maximum number of desired bins. This value will be used in an algorithm that will decide the optimal bin size such that the histogram best visualizes the distribution of the data. Ignored if `xbins.size` is provided.</param>
/// <param name="NBinsY">Specifies the maximum number of desired bins. This value will be used in an algorithm that will decide the optimal bin size such that the histogram best visualizes the distribution of the data. Ignored if `ybins.size` is provided.</param>
/// <param name="XBins">Sets the binning across the x dimension</param>
/// <param name="YBins">Sets the binning across the y dimension</param>
/// <param name="ColorBar">Sets the styles of the colorbar for this trace.</param>
/// <param name="ColorScale">Sets the colorscale for this trace.</param>
/// <param name="ShowScale">Whether or not to show the colorscale/colorbar</param>
/// <param name="ReverseScale">Reverses the color mapping if true. If true, `zmin` will correspond to the last color in the array and `zmax` will correspond to the first color.</param>
/// <param name="ZSmooth">Picks a smoothing algorithm use to smooth `z` data.</param>
/// <param name="UseDefaults">If set to false, ignore the global default settings set in `Defaults`</param>
public static GenericChart Histogram2D<XType, YType, ZType>(
IEnumerable<XType> x,
IEnumerable<YType> y,
Optional<IEnumerable<IEnumerable<ZType>>> Z = default,
Optional<string> Name = default,
Optional<bool> ShowLegend = default,
Optional<double> Opacity = default,
Optional<int> XGap = default,
Optional<int> YGap = default,
Optional<StyleParam.HistFunc> HistFunc = default,
Optional<StyleParam.HistNorm> HistNorm = default,
Optional<int> NBinsX = default,
Optional<int> NBinsY = default,
Optional<Bins> XBins = default,
Optional<Bins> YBins = default,
Optional<ColorBar> ColorBar = default,
Optional<StyleParam.Colorscale> ColorScale = default,
Optional<bool> ShowScale = default,
Optional<bool> ReverseScale = default,
Optional<StyleParam.SmoothAlg> ZSmooth = default,
Optional<bool> UseDefaults = default
)
where XType : IConvertible
where YType : IConvertible
where ZType : IConvertible
=>
Plotly.NET.Chart2D_Histogram.Chart.Histogram2D<XType, YType, IEnumerable<ZType>, ZType>(
x: x,
y: y,
Z: Z.ToOption(),
Name: Name.ToOption(),
ShowLegend: ShowLegend.ToOption(),
Opacity: Opacity.ToOption(),
XGap: XGap.ToOption(),
YGap: YGap.ToOption(),
HistFunc: HistFunc.ToOption(),
HistNorm: HistNorm.ToOption(),
NBinsX: NBinsX.ToOption(),
NBinsY: NBinsY.ToOption(),
XBins: XBins.ToOption(),
YBins: YBins.ToOption(),
ColorBar: ColorBar.ToOption(),
ColorScale: ColorScale.ToOption(),
ShowScale: ShowScale.ToOption(),
ReverseScale: ReverseScale.ToOption(),
ZSmooth: ZSmooth.ToOption(),
UseDefaults: UseDefaults.ToOption()
);
/// <summary>Creates a 2D histogram from encoded x and y data.</summary>
/// <param name="xEncoded">Sets the x sample data as an encoded typed array.</param>
/// <param name="yEncoded">Sets the y sample data as an encoded typed array.</param>
/// <param name="zEncoded">Sets the z aggregation data as an encoded typed array.</param>
/// <param name="UseDefaults">If set to false, ignore the global default settings set in <c>Defaults</c></param>
public static GenericChart Histogram2D(
EncodedTypedArray xEncoded,
EncodedTypedArray yEncoded,
Optional<EncodedTypedArray> zEncoded = default,
Optional<string> Name = default,
Optional<bool> ShowLegend = default,
Optional<double> Opacity = default,
Optional<int> XGap = default,
Optional<int> YGap = default,
Optional<StyleParam.HistFunc> HistFunc = default,
Optional<StyleParam.HistNorm> HistNorm = default,
Optional<int> NBinsX = default,
Optional<int> NBinsY = default,
Optional<Bins> XBins = default,
Optional<Bins> YBins = default,
Optional<ColorBar> ColorBar = default,
Optional<StyleParam.Colorscale> ColorScale = default,
Optional<bool> ShowScale = default,
Optional<bool> ReverseScale = default,
Optional<StyleParam.SmoothAlg> ZSmooth = default,
Optional<bool> UseDefaults = default
)
=>
Plotly.NET.Chart2D_Histogram.Chart.Histogram2D(
xEncoded: xEncoded,
yEncoded: yEncoded,
zEncoded: zEncoded.ToOption(),
Name: Name.ToOption(),
ShowLegend: ShowLegend.ToOption(),
Opacity: Opacity.ToOption(),
XGap: XGap.ToOption(),
YGap: YGap.ToOption(),
HistFunc: HistFunc.ToOption(),
HistNorm: HistNorm.ToOption(),
NBinsX: NBinsX.ToOption(),
NBinsY: NBinsY.ToOption(),
XBins: XBins.ToOption(),
YBins: YBins.ToOption(),
ColorBar: ColorBar.ToOption(),
ColorScale: ColorScale.ToOption(),
ShowScale: ShowScale.ToOption(),
ReverseScale: ReverseScale.ToOption(),
ZSmooth: ZSmooth.ToOption(),
UseDefaults: UseDefaults.ToOption()
);
}