Horizontal Bars
val actors by columnOf(
"John Doe", "Emma Stone", "Ryan Gosling", "Natalie Portman",
"Brad Pitt", "Marilyn Monroe", "Leonardo DiCaprio"
)
val screenTime by columnOf(90, 75, 60, 85, 50, 40, 95)
val dataset = dataFrameOf(actors, screenTime)
dataset.plot {
layout.title = "Screen Time of Hollywood Actors"
barsH {
y(actors) { axis.name = "Actors" }
x(screenTime) { axis.name = "minutes" }
alpha = 0.75
fillColor(actors) {
scale = categoricalColorHue()
}
}
}
val actors = listOf(
"John Doe", "Emma Stone", "Ryan Gosling", "Natalie Portman",
"Brad Pitt", "Marilyn Monroe", "Leonardo DiCaprio"
)
val screenTime = listOf(90, 75, 60, 85, 50, 40, 95)
plot {
layout.title = "Screen Time of Hollywood Actors"
barsH {
y(actors) { axis.name = "Actors" }
x(screenTime) { axis.name = "minutes" }
alpha = 0.75
fillColor(actors) {
legend.name = "actors"
scale = categoricalColorHue()
}
}
}
Last modified: 06 December 2023