Closed Waschnick closed 3 years ago
Hi! There is one JAR that you have to include:
implementation 'org.jetbrains.lets-plot-kotlin:lets-plot-kotlin-api:1.1.0'
(Gradle)
But then you have to choose between your rendering options:
org.jetbrains.lets-plot:lets-plot-batik:1.5.4
(or org.jetbrains.lets-plot:lets-plot-jfx:1.5.4
)ggsave()
to save plot to a file and then just use your browser or any other viewer (IDEA can do) to see the plot.Does this cover your needs or you had something different in mind?
Here is the doc: README_DEV.md
Except the lets-plot-common
artifact is not 'required' - I believe, it's included automatically, by dependency in the lets-plot-kotlin-api
.
Ah ok thank you very much for your help. I think I misread the docs, which mentioned to download and build everything locally and work with different snapshot versions. For completeness and after tinkering a little to get everything running, here is my example code:
I added the jetbrains repository to my maven config and the artifact as dependency:
<repositories>
<repository>
<id>JB-Lets-Plot</id>
<url>https://dl.bintray.com/jetbrains/lets-plot-maven/</url>
</repository>
</repositories>
<dependency>
<groupId>org.jetbrains.lets-plot-kotlin</groupId>
<artifactId>lets-plot-kotlin-api</artifactId>
<version>1.1.0</version>
</dependency>
<dependency>
<groupId>org.jetbrains.lets-plot</groupId>
<artifactId>lets-plot-image-export</artifactId>
<version>1.5.5</version>
</dependency>
fun run() {
val rand = java.util.Random()
val data = mapOf<String, Any>(
"rating" to List(200) { rand.nextGaussian() } + List(200) { rand.nextGaussian() * 1.5 + 1.5 },
"cond" to List(200) { "A" } + List(200) { "B" }
)
var p = lets_plot(data)
p += geom_density(color = "dark_green", alpha = .3) { x = "rating"; fill = "cond" }
p + ggsize(500, 250)
ggsave(p, "demo.png")
}
Thank you very much for your fast help, really appreciate it! And also love the lib, I'm going to use it in multiple projects.
Hey! Could you please release one dependency to use with pure JVM applications? Like
org.jetbrains.lets-plot-kotlin:lets-plot-kotlin-standalone
?I'm parsing huge log files locally with Kotlin and creating statistics. Would be nice to have some plots for my stats. Just adding one dependency and then starting to plot.
I understand that there are instructions to run this in a JVM application, but that's just overkill.