Density Plot With Histogram
val df = DataFrame.readCSV(
fileOrUrl = "https://raw.githubusercontent.com/Kotlin/dataframe/master/examples/idea-examples/titanic/src/main/resources/titanic.csv",
delimiter = ';', parserOptions = ParserOptions(locale = java.util.Locale.FRENCH)
)
val ages = df["age"].dropNulls().cast<Double>()
plot {
histogram(ages) {
alpha = 0.9
fillColor = Color.BLUE
y(Stat.density)
}
densityPlot(ages) {
alpha = 0.5
fillColor = Color.hex(0xFF6666)
}
layout.title = "Titanic passengers age distribution"
}
Last modified: 10 May 2024