-
Notifications
You must be signed in to change notification settings - Fork 0
SVGraph_BarPlot()
CapnOdin edited this page Jan 11, 2018
·
10 revisions
Draws a stack of bars for each element of an array.
SVGraph_BarPlot(Data [, Colour, Width, Opacity])
A list of integer-lists, where each integer-list represent a stack of bars. Each bar is plotted based on its index.
The colour of the bars, supports HTML Color Names or Color Values. e.g. "lightgrey" or "#FF00FF".
The width of the bars, as a number followed by an optional Unit e.g. 3 or "5mm".
Note: If the unit is included there should be no space between the number and the unit.
A value in the range [0, 1], where 0 is fully transparent and 1 is fully opaque.
.
; Simple bar plot along the x-axis
SVGraph_Chart(width := 400, height := 475, margin := 40)
SVGraph_SetAxes(xmin := 0, xmax := 6, ymin := 0, ymax := 100)
SVGraph_BarPlot([[20],[40],[80],[40],[20]], , 20, "x")
; Simple bar plot along the y-axis
SVGraph_Chart(width := 475, height := 400, margin := 40)
SVGraph_SetAxes(xmin := 0, xmax := 100, ymin := 0, ymax := 6)
SVGraph_BarPlot([[20],[40],[80],[40],[20]], , 20, "y")
; A staked bar plot
SVGraph_Chart(width := 960, height := 500, margin := 40)
SVGraph_SetAxes(xmin := 0, xmax := 30, ymin := -10, ymax := 15)
Bars := []
Loop 29 {
val := A_Index < 16 ? A_Index - 6 : 24 - A_Index
Bars.Push([val, val/2])
}
SVGraph_BarPlot(Bars, , 20)
; Bar plot of the composition of glass
SVGraph_Chart(width := 960, height := 500, margin := 40)
SVGraph_SetAxes(xmin := 0, xmax := 11, ymin := 0, ymax := 100)
SVGraph_SetGrid("x", "[1,2,3,4,5,6,7,8,9,10]")
SVGraph_MakeLegend(["Na","Mg","Al","Si","K","Ca","Ba","Fe"])
SVGraph_BarPlot([[13.64,4.49,1.10,71.78,0.06,8.75,0.00,0.00]
,[13.89,3.60,1.36,72.73,0.48,7.83,0.00,0.00]
,[13.53,3.55,1.54,72.99,0.39,7.78,0.00,0.00]
,[13.21,3.69,1.29,72.61,0.57,8.22,0.00,0.00]
,[13.27,3.62,1.24,73.08,0.55,8.07,0.00,0.00]
,[12.79,3.61,1.62,72.97,0.64,8.07,0.00,0.26]
,[13.30,3.60,1.14,73.09,0.58,8.17,0.00,0.00]
,[13.15,3.61,1.05,73.24,0.57,8.24,0.00,0.00]
,[14.04,3.58,1.37,72.08,0.56,8.30,0.00,0.00]
,[13.00,3.60,1.36,72.99,0.57,8.40,0.00,0.11]], , 20)