Basic Scatter Plot
a sketch by
Pierre Mariac
Snapshot
Settings
Save
View
Editor
Details
Sign up
Log in
import io.data2viz.charts.* import io.data2viz.charts.core.CursorType import io.data2viz.charts.dimension.* import io.data2viz.charts.chart.* import io.data2viz.charts.chart.mark.* import io.data2viz.charts.viz.* import io.data2viz.charts.layout.* import io.data2viz.geom.* import kotlin.random.Random val width = 700.0 val height = 500.0 val randomPoints = (1 .. 1000).map{ Point(Random.nextDouble(), Random.nextDouble()) } fun main() { // Creating and sizing the VizContainer val vc = newVizContainer().apply { size = Size(width, height) } // Chart DSL, our domain object is a "Point" vc.chart(randomPoints) { config { // Display the cursor cursor { show = true } } // Create 2 continuous numeric dimensions val xPosition = quantitative( { domain.x } ) val yPosition = quantitative( { domain.y } ) // Plot values plot(xPosition, yPosition) } }
Sketch Settings
Sketch description
Basic scatter plot in Charts-kt displaying random points.
Sketch Thumbnail
Sketch DELETE
DELETE CURRENT SKETCH