Skip to content

Commit 48f99ab

Browse files
committed
Fix histogram
1 parent 236a563 commit 48f99ab

File tree

3 files changed

+44
-17
lines changed

3 files changed

+44
-17
lines changed

docs/content/box-plots.fsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,3 +45,6 @@ let y' = [2.; 1.5; 5.; 1.5; 2.; 2.5; 2.1; 2.5; 1.5; 1.;2.; 1.5; 5.; 1.5; 3.; 2.
4545
|> Chart.Combine
4646
(*** include-it:box3 ***)
4747

48+
49+
50+

docs/content/getting-started.fsx

Lines changed: 36 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,25 +16,48 @@ The library provides a complete mapping for the configuration options of the und
1616
#r "../../bin/FSharp.Plotly.dll"
1717
open FSharp.Plotly
1818

19+
// Functional F# scripting style
1920

20-
Trace.initScatter (fun scatter ->
21-
scatter?x <- [1; 2; 3; 4]
22-
scatter?y <- [1; 2; 3; 4]
23-
scatter?mode <- "lines+markers"
24-
scatter?name <- "lines and markers"
25-
scatter
26-
)
21+
22+
Chart.Scatter ([1; 2; 3; 4],[12; 9; 15; 12],
23+
StyleParam.Mode.Lines_Markers,
24+
Name="lines and markers")
25+
26+
27+
// Dynanic object
28+
29+
let scattern =
30+
let dyn = Trace("scatter")
31+
dyn?x <- [1; 2; 3; 4]
32+
dyn?y <- [12; 9; 15; 12]
33+
dyn?mode <- "lines+markers"
34+
dyn?name <- "lines and markers"
35+
dyn
36+
37+
scattern
2738
|> GenericChart.ofTraceObject
28-
|> Chart.Show
2939

3040

3141

3242

43+
Trace.initScatter (
44+
Trace.TraceStyle.Scatter
45+
( X = [1; 2; 3; 4],
46+
Y = [12; 9; 15; 12],
47+
Mode = StyleParam.Mode.Lines_Markers
48+
) )
49+
|> Trace.TraceStyle.TraceInfo(Name="lines and markers")
50+
|> GenericChart.ofTraceObject
51+
3352

34-
open FSharp.Care.Colors
35-
let red' = FSharp.Care.Colors.toHex false Table.Office.red
3653

37-
Chart.Point([1; 2; 3; 4],[12; 9; 15; 12])
38-
|> Chart.withMarkerStyle(Color=red')
39-
|> Chart.Show
54+
Trace.initScatter
55+
(fun scatter ->
56+
scatter?x <- [1; 2; 3; 4]
57+
scatter?y <- [12; 9; 15; 12]
58+
scatter?mode <- "lines+markers"
59+
scatter?name <- "lines and markers"
60+
scatter
61+
)
62+
|> GenericChart.ofTraceObject
4063

src/FSharp.Plotly/Chart.fs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -378,20 +378,21 @@ type Chart =
378378
|> GenericChart.ofTraceObject
379379

380380
/// Computes a histogram with auto-determined the bin size.
381-
static member Histogram(data,?Orientation,?Name,?Showlegend,?Marker,?HistNorm,?HistFunc,?nBinsx,?nBinsy,?Xbins,?Ybins,?xError,?yError) =
381+
static member Histogram(data,?Orientation,?Name,?Showlegend,?Opacity,?Color,?HistNorm,?HistFunc,?nBinsx,?nBinsy,?Xbins,?Ybins,?xError,?yError) =
382382
Trace.initHistogram (
383383
TraceStyle.Histogram (X=data,?Orientation=Orientation,?HistNorm=HistNorm,?HistFunc=HistFunc,
384384
?nBinsx=nBinsx,?nBinsy=nBinsy,?xBins=Xbins,?yBins=Ybins)
385385
)
386-
|> TraceStyle.TraceInfo(?Name=Name,?Showlegend=Showlegend)//,?Opacity=Opacity)
386+
|> TraceStyle.Marker(?Color=Color)
387+
|> TraceStyle.TraceInfo(?Name=Name,?Showlegend=Showlegend,?Opacity=Opacity)
387388
|> GenericChart.ofTraceObject
388389

389390
/// Computes the bi-dimensional histogram of two data samples and auto-determines the bin size.
390-
static member Histogram2d(x,y,?Z,?Name,?Showlegend,?Colorscale,?Showscale,?zSmooth,?Colorbar,?zAuto,?zMin,?zMax,?nBinsx,?nBinsy,?Xbins,?Ybins,?HistNorm,?HistFunc) =
391+
static member Histogram2d(x,y,?Z,?Name,?Showlegend,?Opacity,?Colorscale,?Showscale,?zSmooth,?Colorbar,?zAuto,?zMin,?zMax,?nBinsx,?nBinsy,?Xbins,?Ybins,?HistNorm,?HistFunc) =
391392
Trace.initHistogram2d (
392393
TraceStyle.Histogram2d (X=x, Y=y,? Z=Z,
393394
?Colorscale=Colorscale,?Showscale=Showscale,?zSmooth=zSmooth,?Colorbar=Colorbar) )
394-
|> TraceStyle.TraceInfo(?Name=Name)//,?Showlegend=Showlegend,?Opacity=Opacity)
395+
|> TraceStyle.TraceInfo(?Name=Name,?Showlegend=Showlegend,?Opacity=Opacity)
395396
|> GenericChart.ofTraceObject
396397

397398

0 commit comments

Comments
 (0)