Version 0.5.4 of the documentation is no longer actively maintained. The site that you are currently viewing is an archived snapshot. For up-to-date documentation, see the latest version.

Getting Started

Quickly get started with Koala Plot

Repositories

Add the mavenCentral and compose repositories to your project’s build.gradle.kts

1
2
3
4
5
repositories {
    mavenCentral()
    maven("https://maven.pkg.jetbrains.space/public/p/compose/dev")
    mavenLocal()
}

Including mavenLocal() is optional, if you want to use pre-release builds you create locally.

Dependencies

Include Koala Plot core as a dependency in your project’s build.gradle.kts

1
                implementation("io.github.koalaplot:koalaplot-core:0.5.1")

You can also see a complete example of a build.gradle.kts in the samples.

First Plot

The below plots the function \( y=x^2 \) with x from 1 to 10:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
    val data = buildList {
        for (i in 1..10) {
            add(DefaultPoint(i.toFloat(), i * i.toFloat()))
        }
    }

    XYGraph(
        rememberLinearAxisModel(data.autoScaleXRange()),
        rememberLinearAxisModel(data.autoScaleYRange())
    ) {
        LinePlot(
            data,
            lineStyle = LineStyle(SolidColor(Color.Blue))
        )
    }
/examples/src/jvmMain/kotlin/io/github/koalaplot/example/Line1.kt

Line1


Last modified November 22, 2023: Add website (6de4820)