statSummaryBin()
¶%useLatestDescriptors
%use dataframe
%use lets-plot
var irisDf = DataFrame.readCSV("https://raw.githubusercontent.com/JetBrains/lets-plot-docs/master/data/iris.csv")
val irisData = irisDf.toMap()
irisDf.head()
DataFrame: rowsCount = 5, columnsCount = 5
sepal_length | sepal_width | petal_length | petal_width | species |
---|---|---|---|---|
5.100000 | 3.500000 | 1.400000 | 0.200000 | setosa |
4.900000 | 3.000000 | 1.400000 | 0.200000 | setosa |
4.700000 | 3.200000 | 1.300000 | 0.200000 | setosa |
4.600000 | 3.100000 | 1.500000 | 0.200000 | setosa |
5.000000 | 3.600000 | 1.400000 | 0.200000 | setosa |
geom
Parameter¶letsPlot(irisData) { x = "petal_length"; y = "sepal_length" } +
statSummaryBin(geom = Geom.crossbar(width = 1.0), binWidth = 0.5) +
geomPoint(shape = 21, stroke=0.5)
fn
, fnMin
, fnMax
Parameters¶letsPlot(irisData) { x = "petal_length"; y = "sepal_length" } +
statSummaryBin(geom = Geom.crossbar(width = 1.0), binWidth = 0.5,
fn = "mq", fnMin = "lq", fnMax = "uq") +
geomPoint(shape = 21, stroke=0.5)
quantiles
Parameter¶letsPlot(irisData) { x = "petal_length"; y = "sepal_length" } +
statSummaryBin(geom = Geom.crossbar(width = 1.0), binWidth = 0.5,
fn = "mq", fnMin = "lq", fnMax = "uq",
quantiles = listOf(0.05, 0.5, 0.95)) +
geomPoint(shape = 21, stroke=0.5)
center
and boundary
Parameters¶fun getPlot(center: Double? = null, boundary: Double? = null): org.jetbrains.letsPlot.intern.Plot {
return letsPlot(irisData) { x = "petal_length"; y = "sepal_length" } +
statSummaryBin(geom = Geom.crossbar(width = 1.0), binWidth = 0.5,
center = center, boundary = boundary) +
geomPoint(shape = 21, stroke=0.5) +
ggtitle("center = $center; boundary = $boundary")
}
gggrid(listOf(
getPlot(),
getPlot(center = 1.0),
getPlot(boundary = 1.0)
), ncol = 2)
letsPlot(irisData) { x = "petal_length"; y = "sepal_length" } +
statSummaryBin(geom = Geom.crossbar(width = 1.0),
fn = "median", binWidth = 0.5, color = "white")
{ fill = "..y.." } +
geomPoint(shape = 21, stroke=0.5)