Kotlin API for Lets-Plot - an open-source plotting library for statistical data.

Overview

Lets-Plot for Kotlin official JetBrains project

Latest Lets-Plot Kotlin API Version
Latest Lets-Plot Version
License

Overview

Lets-Plot for Kotlin is a Kotlin API for the Lets-Plot library - an open-source plotting library for statistical data.

Lets-Plot Kotlin API is built on the principles of layered graphics first described in the Leland Wilkinson work The Grammar of Graphics and later implemented in the ggplot2 package for R.

This grammar [...] is made up of a set of independent components that can be composed in many different ways. This makes [it] very powerful because you are not limited to a set of pre-specified graphics, but you can create new graphics that are precisely tailored for your problem.

Read Lets-Plot Usage Guide for quick introduction to the Grammar of Graphics and Lets-Plot Kotlin API.

Lets-Plot in Jupyter with Kotlin Kernel

Installation

In Jupyter notebook with a Kotlin Kernel, Lets-Plot library is available out-of-the-box. To install Kotlin Kernel and OpenJDK into a Conda environment, run the following command:

conda install kotlin-jupyter-kernel -c jetbrains

For more information about Jupyter Kotlin kernel, see the Kotlin kernel for Jupyter/iPython project.

"Line Magics"

You can include all the necessary Lets-Plot boilerplate code to a notebook using the following "line magic":

%use lets-plot

This will apply the lets-plot library descriptor bundled with the Kotlin Jupyter Kernel installed in your environment.

The %useLatestDescriptors line magic will force Kotlin Kernel to pull and apply the latest repository version of all library descriptors.

You can override lets-plot library descriptor settings using the lets-plot line magic parameters, like:

%use lets-plot(api=1.1.0, lib=1.5.4, js=1.5.4, isolatedFrame=false)

Where:

  • api - version of Lets-Plot Kotlin API.
  • lib - version of Lets-Plot library (JAR-s).
  • js - version of Lets-PLot JavaScript bundle.
  • isolatedFrame - If false: load JS just once per notebook (default in Jupyter). If true: include Lets-Plot JS in each output (default in Datalore notebooks)

See: Line Magics documentation in the Kotlin Jupyter project for more details.

Quickstart in Jupyter

  • In Jupyter, create a new notebook and choose the Kotlin kernel (see the instructions for more details on how to select a kernel).

  • Add the following code to a Jupyter notebook:

%use lets-plot
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)
  • Execute the added code to evaluate the plotting capabilities of Lets-Plot.

Couldn't load quickstart.png



Example of notebooks

Try the following examples to study features of the Lets-Plot library.

Lets-Plot-Kotlin in Datalore notebooks

Datalore is an online data science notebook by JetBrains.

In Datalore notebook you can run Kotlin code directly in your browser. Many popular Kotlin libraries are preinstalled and readily available (see the list of supported Kotlin libraries).

See Quickstart in Datalore example notebook to learn more about Kotlin support in Datalore.

Watch the Datalore Getting Started Tutorial video for a quick introduction to Datalore.

Lets-Plot in JVM and Kotlin/JS application

Apart from Jupyter notebooks, Lets-Plot library and Kotlin API enables embedding plots into a JVM and a Kotlin/JS application.

See README_DEV.md to learn more about creating plots in JVM or Kotlin/JS environment.

In the lets-plot-mini-apps GitHub repository you will find examples of using Lets-Plot Kotlin API in JVM and Kotlin/JS projects.

Further Reading

User guide and API reference

Tooltip customization

You can customize the content, values formatting and appearance of tooltip for any geometry layer in your plot.

Learn more: Tooltip Customization.

Formatting

Formatting of numeric and date-time values in tooltips, legends, on the axes and text geometry layer.

Learn more: Formatting.

Data sampling

Sampling is a special technique of data transformation, which helps to deal with large datasets and overplotting.

Learn more: Data Sampling.

Saving plot to a file

The ggsave() function is a convenient way of saving a plot or a GGBunch object to a file.

The supported export formats are: SVG, HTML, PNG, JPEG and TIFF.

For example, the code below will save plot as a PNG image to the file <user dir>//lets-plot-images/density.png:

%use lets-plot

val rand = java.util.Random(123)
val n = 400
val data = mapOf (
    "rating" to List(n/2) { rand.nextGaussian() } + List(n/2) { rand.nextGaussian() * 1.5 + 1.5 },
    "cond" to List(n/2) { "A" } + List(n/2) { "B" }
)

var p = lets_plot(data) +
        geom_density { x = "rating"; color = "cond" } + ggsize(500, 250)
        
ggsave(p, "density.png")        

Couldn't load ggsave_demo.png


See ggsave() documentation for more information about the function arguments and default values.

GeoTools support

GeoTools is an open source Java GIS Toolkit.

Lets-Plot supports visualization of a set of SimpleFeature-s stored in SimpleFeatureCollection, as well as individual Geometry and ReferencedEnvelope objects.

Learn more: GeoTools Support.

What is new in 3.1.0

  • Added support for coordFlip().

    See: example notebook .

  • Improved plot appearance and better theme support:

    • Bigger fonts across the board;
    • Gridlines;
    • 4 themes from ggplot2 (R) library: themeGrey(), themeLight(), themeClassic(), themeMinimal();
    • Our designer theme: themeMinimal2() (used by default);
    • themeNone() for the case you want to design another theme;
    • A lot more parameters in the theme() function, also helpers: elementLine(), elementRect(), elementText().

    See: example notebook .

Note: fonts size, family and face still can not be configured.

  • Improved Date-time formatting support:

    • tooltip format() should understand date-time format pattern [#387];
    • scaleXDatetime should apply date-time formatting to the breaks [#392].

    See Out[7, 8, 10] in the example notebook .

  • CorrPlot() function now also accepts pre-computed correlation coefficients.

  • Kotlin/JS IR: xxx.klib artifacts are now available.

    See: sample Kotlin/JS IR app

  • Other improvements and fixes - see CHANGELOG.md for details.

Change Log

See CHANGELOG.md.

License

Code and documentation released under the MIT license. Copyright © 2019-2021, JetBrains s.r.o.

Comments
  • geom_line data series is getting sorted on SVG export

    geom_line data series is getting sorted on SVG export

    Currently, I am working with geospatial data. I have a problem if I want to plot the contour lines. The dataset might not be sorted by the x-axis, as the lines might contain curves going back or might even be circles.

    When I create a single Feature from a map containing all coordinates of the line via geom_line(map) the plot via PlotSvgExport.buildSvgImageFromRawSpecs(plotSpecRaw) is looking quite strange.

    2020-09-14_15-59-23

    If I inspect the resulting .svg, I can see that the plotted parts are sorted by x-axis, even though they are not sorted in the lists stored in the map

    <path d="M616.0933693197439 278.4722567444842 L616.0933693197439 278.4722567444842 L616.1966374794138 276.7657731094514 L616.4902197569609 275.5389922473987 L616.6647073370405 279.4956226601789 L616.803585206857 274.6645176841994 L617.3199260049732 279.96274306534906 L617.5771072454518 273.76487838532194 L618.269518277375 273.5404928259668 L618.536591103999 280.47966867647483 L619.543554576172 273.66159811618854 L621.0407450590283 274.08468023399473 L621.7343430813053 282.2642678450211 L622.5383312052581 274.5764411095006 L623.7324434878537 275.1421233958681 L623.7553919677157 283.55396054615267 L624.679661779548 275.19612272438826 L624.9914445756585 284.2475635720184 L625.9081967819366 274.77356487192446 L626.1705216472037 284.54429774635355 L627.972768647538 285.60016811219975 L628.0847414030577 273.54363841793383 L628.8990167765878 286.4028183258197 L630.2122237566509 287.67625880186097 L630.7515130346874 288.0767975106428 L630.8927648852114 272.313711963885 L631.7430456324364 288.7090614934277 L632.9130224447581 289.1698907146638 L634.262630461948 270.51862748884014 L634.6357410922647 290.05852044170024 L635.3859189875075 269.9529452024435 L635.947365418484 269.46066006162437 L636.163397660479 291.3906786341977 L636.6259282298852 268.944258715841 L637.3472226934391 268.68317458365345 L638.4986033237074 268.6538157254399 L639.1150469739223 268.7177760951745 L640.4713812696282 269.01293747351156 L641.1756622050307 269.2079641746823 L642.5007390884566 269.679278702446 L643.8495557787246 270.51286057021935 L645.2537653515465 272.0500065051019 L646.2678507657838 273.40313531065476 L646.9278173950734 283.87952931338805 L646.9851885949029 282.57463291779277 L647.0263375933282 274.9402812454791 L647.1501802522107 284.27849522623 L647.4311012994731 281.26763946091523 L647.6835345785366 280.500639289472 L647.7432797590154 276.62893985945266 L648.0633714874857 279.31317832687637 L648.1464608113747 277.9679135011975 " fill="none" stroke-width="1.0" stroke="rgb(0,0,128)" stroke-opacity="1.0">
    </path>
    

    In case I plot every single line on it's own, the file gets so huge that I can not see anything anymore.

    Is there any way to force the svg export not to sort the given Features by x-axis? What can I do instead?

    opened by mlthlschr 18
  • Documentation for using Maven artifacts

    Documentation for using Maven artifacts

    Hi Igor et al., nice work here! Are you planning to support consumers of this API outside a Jupyter notebook? If so, it would be nice to have some documentation on which dependencies are necessary. Based on the build.gradle file, I was able to locate the Bintray artifacts, and noticed you have written some demos, so it looks like a few use cases are already supported. Specifically, it would be nice to have a quick section in the readme for how to configure Maven/Gradle and output plots to a file or JFX window.

    Also, what is the difference between this repository and JetBrains/lets-plot, and where is the appropriate place to file issues? Thanks!

    opened by breandan 17
  • "Duplicate class .. found in modules ..." triggered by appcompat and lets-plot-common libraries

    I am using the kotlin lets plot api, which works 100% on jupyter and in standalone apps,

    however I'm trying to use it on an android app and at the moment to build I get a bunch of errors that say like this

    Duplicate class kotlin.ArrayIntrinsicsKt found in modules jetified-kotlin-stdlib-1.3.72.jar (org.jetbrains.kotlin:kotlin-stdlib:1.3.72) and jetified-lets-plot-common-1.3.1.jar (org.jetbrains.lets-plot:lets-plot-common:1.3.1)

    and

    Duplicate class org.jetbrains.annotations.TestOnly found in modules jetified-annotations-13.0.jar (org.jetbrains:annotations:13.0) and jetified-lets-plot-common-1.3.1.jar (org.jetbrains.lets-plot:lets-plot-common:1.3.1)

    I understand that I have to choose only one of the libraries to be compiled, but if I remove lets-plot from the gradle the project renders unusable at 'grafica.kt'

    My question is:

    Can I remove 'org.jetbrains.kotlin:kotlin-stdlib:1.3.72' and 'org.jetbrains:annotations:13.0' safely? and If so, how can I do this?

    Thanks in advance!

    Project description: User inputs two numbers and the app displays a plot of them

    I've opened the same issue at :

    https://youtrack.jetbrains.com/issue/KT-39737

    where I've attached a sample project

    Plot_app.zip

    opened by descent2oblivion 10
  • How to plot TimeSeries?

    How to plot TimeSeries?

    Is there any example notebook to show how to plot timeseries data with time in X-axis?

    X-axis data could be any of the Datetime classes like LocalDate, LocalDateTime or ZonedDateTime etc

    opened by wangtieqiao 9
  • Some dependency issues migrating to 3.0.0

    Some dependency issues migrating to 3.0.0

    After updating to 3.0.0, I encountered the following error:

    Cannot access class 'jetbrains.datalore.vis.svgToString.SvgToString'. Check your module classpath for missing or conflicting dependencies
    

    After reading the dev docs, I added this dependency:

    implementation("org.jetbrains.lets-plot:lets-plot-jfx:2.0.3")
    

    This did not work due the following error:

    Could not find org.jetbrains.kotlinx:kotlinx-html-jvm:0.7.2.
    

    Then I added this dependency:

    implementation("org.jetbrains.kotlinx:kotlinx-html-jvm:0.7.3")
    

    And everything worked again.

    opened by breandan 6
  • X axis labels are not sorted alphanumerically

    X axis labels are not sorted alphanumerically

    I'm trying to visualize a number of commits made per module in my single-repo project, per month. On X axis I want to have labels like 2020-04, and Y axis should show the number of commits. My code is as follows:

        ...
        val plotData = mapOf (
            "yearMonth" to yearMonths,
            "module" to modules,
        )
    
        var plot = lets_plot(plotData) +
                geom_bar { x = "yearMonth"; fill = "module" } +
                ggsize(1920, 1080) +
                ggtitle("Number of commits per module")
    

    Everything works fine, except that I'm getting such order of labels which looks totally random:

    image

    As you can see, the order is not even alphanumeric, and I'd expect it to be so (analogy to ggplot, see e.g. https://sebastiansauer.github.io/ordering-bars/: "And the rule is: ... if character, an alphabetical order ist used"). My data provided in yearMonths is ordered the way I want (alphanumerically).

    How can I control the order of the labels? I'm also curious what's the contract with lets-plot for this matter. How about sorting it alphanumerically by default, and providing a way to customize it?

    I didn't manage to reproduce it on a smaller set of data.

    opened by krzema12 6
  • Viewing the plot-api documentation online

    Viewing the plot-api documentation online

    When I go to https://github.com/JetBrains/lets-plot-kotlin/blob/master/docs/guide/user_guide.ipynb and click on the geom_reference link to get to the documentation, I get a 404. I don't exactly know why, the link seems to be correct (when I hover over it). When I copy the url manually and visit https://render.githubusercontent.com/plot-api/docs/plot-api/jetbrains.lets-plot.geom/index.html then I get an 'Unknown type'.

    For now I just render with htmlpreview: https://htmlpreview.github.io/?https://github.com/JetBrains/lets-plot-kotlin/blob/master/plot-api/docs/plot-api/index.html, but a proper solution would be convenient.

    opened by PHPirates 5
  • `LinearBreaksHelper$Companion.computeNiceBreaks` out of memory error

    `LinearBreaksHelper$Companion.computeNiceBreaks` out of memory error

    Hi, I've created a plot using following code:

    val data = mapOf(
        "Task interval coefficient of variation" to listOf(1.17546, 1.19216, 1.20941, 1.22708, 1.24521, 1.26378, 1.28274, 1.30207, 1.32178, 1.34187, 1.3623, 1.383, 1.40404, 1.42535, 1.44695, 1.46884, 1.49097, 1.51339, 1.53597, 1.55886),
        "Average processing time" to listOf(41.1325, 41.1325, 41.1325, 41.1325, 41.1325, 41.1325, 41.1325, 41.1325, 41.1325, 41.1325, 41.1325, 41.1325, 41.1325, 41.1325, 41.1325, 41.1325, 41.1325, 41.1325, 41.1325, 41.1325)
    )
    
    val plot = ggplot(data) { x = "Task interval coefficient of variation"; y = "Average processing time" } + geomPoint() + geomSmooth()
    

    Unfortunately, when trying to save it to PNG file using following code:

    ggsave(plot, "p1.png")
    

    I've got following error:

    Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
    	at java.base/java.lang.Double.valueOf(Double.java:537)
    	at jetbrains.datalore.plot.base.scale.breaks.LinearBreaksHelper$Companion.computeNiceBreaks(LinearBreaksHelper.kt:82)
    	at jetbrains.datalore.plot.base.scale.breaks.LinearBreaksHelper$Companion.access$computeNiceBreaks(LinearBreaksHelper.kt:42)
    	at jetbrains.datalore.plot.base.scale.breaks.LinearBreaksHelper.<init>(LinearBreaksHelper.kt:30)
    	at jetbrains.datalore.plot.base.scale.breaks.LinearBreaksHelper.<init>(LinearBreaksHelper.kt:10)
    	at jetbrains.datalore.plot.base.scale.transform.LinearBreaksGen$Companion.generateBreakValues$plot_base_portable(LinearBreaksGen.kt:37)
    	at jetbrains.datalore.plot.base.scale.transform.LinearBreaksGen.generateBreaks(LinearBreaksGen.kt:21)
    	at jetbrains.datalore.plot.base.scale.transform.Transforms$BreaksGeneratorForTransformedDomain.generateBreaks(Transforms.kt:70)
    	at jetbrains.datalore.plot.builder.layout.axis.AdaptableAxisBreaksProvider.getBreaks(AdaptableAxisBreaksProvider.kt:25)
    	at jetbrains.datalore.plot.builder.layout.axis.label.BreakLabelsLayoutUtil.getFlexBreaks(BreakLabelsLayoutUtil.kt:24)
    	at jetbrains.datalore.plot.builder.layout.axis.label.VerticalFlexBreaksLabelsLayout.getBreaks(VerticalFlexBreaksLabelsLayout.kt:53)
    	at jetbrains.datalore.plot.builder.layout.axis.label.VerticalFlexBreaksLabelsLayout.doLayout(VerticalFlexBreaksLabelsLayout.kt:42)
    	at jetbrains.datalore.plot.builder.layout.axis.AxisLayouter.doLayout(AxisLayouter.kt:22)
    	at jetbrains.datalore.plot.builder.layout.PlotAxisLayout.doLayout(PlotAxisLayout.kt:42)
    	at jetbrains.datalore.plot.builder.layout.XYPlotTileLayout$Companion.computeVAxisInfo(XYPlotTileLayout.kt:203)
    	at jetbrains.datalore.plot.builder.layout.XYPlotTileLayout$Companion.computeAxisInfos(XYPlotTileLayout.kt:134)
    	at jetbrains.datalore.plot.builder.layout.XYPlotTileLayout$Companion.access$computeAxisInfos(XYPlotTileLayout.kt:103)
    	at jetbrains.datalore.plot.builder.layout.XYPlotTileLayout.doLayout(XYPlotTileLayout.kt:27)
    	at jetbrains.datalore.plot.builder.layout.SingleTilePlotLayout.doLayout(SingleTilePlotLayout.kt:27)
    	at jetbrains.datalore.plot.builder.PlotSvgComponent.buildPlotComponents(PlotSvgComponent.kt:182)
    	at jetbrains.datalore.plot.builder.PlotSvgComponent.buildPlot(PlotSvgComponent.kt:111)
    	at jetbrains.datalore.plot.builder.PlotSvgComponent.buildComponent(PlotSvgComponent.kt:86)
    	at jetbrains.datalore.plot.base.render.svg.SvgComponent.buildComponentIntern(SvgComponent.kt:46)
    	at jetbrains.datalore.plot.base.render.svg.SvgComponent.ensureBuilt(SvgComponent.kt:39)
    	at jetbrains.datalore.plot.base.render.svg.SvgComponent.getRootGroup(SvgComponent.kt:33)
    	at jetbrains.datalore.plot.builder.PlotContainerPortable.buildContent(PlotContainerPortable.kt:87)
    	at jetbrains.datalore.plot.builder.PlotContainerPortable.ensureContentBuilt(PlotContainerPortable.kt:44)
    	at jetbrains.datalore.plot.MonolithicCommon.buildSvgImagesFromRawSpecs(MonolithicCommon.kt:51)
    	at jetbrains.datalore.plot.PlotSvgExportPortable.buildSvgImageFromRawSpecs(PlotSvgExportPortable.kt:42)
    	at jetbrains.datalore.plot.PlotSvgExport.buildSvgImageFromRawSpecs(PlotSvgExport.kt:25)
    	at jetbrains.datalore.plot.PlotSvgExport.buildSvgImageFromRawSpecs$default(PlotSvgExport.kt:21)
    	at jetbrains.datalore.plot.PlotImageExport.buildImageFromRawSpecs(PlotImageExport.kt:90)
    
    Process finished with exit code 1
    

    The direct reason of error is probably the fact that in LinearBreaksHelper$Companion.computeNiceBreaks function step has such a small value that ticks value is never getting higher, so the program never exits the while loop. image

    opened by a-glapinski 4
  • `show()` should actually show a plot

    `show()` should actually show a plot

    When trying to render a simple plot in a kotlin application

    var p: Plot = lets_plot(data)
            p += geom_density(color = "dark_green", alpha = .3) { x = "rating"; fill = "cond" }
            p + ggsize(500, 250)
            p.show()
    

    it just dies

    Exception in thread "main" java.lang.IllegalStateException: Frontend context is not defined
    	at jetbrains.letsPlot.LetsPlot$frontendContext$1.display(LetsPlot.kt:16)
    	at jetbrains.letsPlot.intern.Plot.show(Core.kt:49)
    	at org.kalasim.test.LetsPlotASimulation.main(DemoTests.kt:42)
    

    It would be cool if (depending on the chosen backend (jfx, batik) a corresponding window could that simply shows the plot.

    Currently the user has to dig through the code-base in particular https://github.com/JetBrains/lets-plot-kotlin/blob/master/demo/jvm-batik/src/main/kotlin/minimalDemo/Main.kt to to finally implement a utility to achieve this core functionality

    fun Plot.showPlot() {
    
    // Setup
    
        val BATIK_MESSAGE_CALLBACK = object : BatikMessageCallback {
            override fun handleMessage(message: String) {
                println(message)
            }
    
            override fun handleException(e: Exception) {
                if(e is RuntimeException) {
                    throw e
                }
                throw RuntimeException(e)
            }
        }
    
        val SVG_COMPONENT_FACTORY_BATIK =
            { svg: SvgSvgElement -> BatikMapperComponent(svg, BATIK_MESSAGE_CALLBACK) }
    
        val AWT_EDT_EXECUTOR = { runnable: () -> Unit ->
            // Just invoke in the current thread.
            runnable.invoke()
        }
    
        SwingUtilities.invokeLater {
    
            // Create Swing Panel showing the plot.
            val plotSpec = toSpec()
            val plotSize = DoubleVector(600.0, 300.0)
    
            val component =
                MonolithicAwt.buildPlotFromRawSpecs(
                    plotSpec,
                    plotSize,
    //                    plotMaxWidth = null,
                    SVG_COMPONENT_FACTORY_BATIK, AWT_EDT_EXECUTOR
                ) {
                    for(message in it) {
                        println("PLOT MESSAGE: $message")
                    }
                }
    
            // Show plot in Swing frame.
            val frame = JFrame("The Minimal")
            frame.contentPane.add(component)
            frame.defaultCloseOperation = WindowConstants.EXIT_ON_CLOSE
            frame.pack()
            frame.isVisible = true
        }
    }
    
    

    Note: Clearly this extension lacks beauty as it is does not adjust the plot width when the user resizes the window. A better approach (similar how PyCharm does it in the ide) would be a small tabbed windows where all plots the users shows with .show() are grouped together. In kravis I've implemented a similar output viewer (although not really pretty as of now): image

    opened by holgerbrandl 4
  • Intellij IDEA scratch file/worksheet support?

    Intellij IDEA scratch file/worksheet support?

    I'm not sure where the best place to ask this is, but has there been work towards adding lets-plot capabilities to Intellij IDEA's Kotlin scratch files? I use scratch files on the daily and being able to quickly plot something without having to set up a new project environment or switch contexts would be huge. Thanks for your great work!

    opened by jsnelgro 4
  • How to make geomImage display 2d array?

    How to make geomImage display 2d array?

    Is it possible to use geomImag like in this examples? https://nbviewer.org/github/JetBrains/lets-plot-docs/blob/master/source/examples/cookbook/image_101.ipynb

    opened by koodzi 3
  • Add a dynamic chart update

    Add a dynamic chart update

    Please release native support of plotting data in realtime. Unfortunately, a trick which is discussed here is just a workaround with significant efforts .

    As @alshan mentioned "Lets-Plot itself doesn't support incremental updates at the moment" but I suppose some kind of a good workaround could be included to the ets-plot-kotlin lib.

    opened by fmvin 0
  • Group by multiple columns

    Group by multiple columns

    Is it possible to make a group by several columns (without mappings to other aesthetics)? For example like this: group = listOf("col1", "col2")

    opened by AndreiKingsley 1
  • Using class and `+` instead of `.`-chained builder for plot composition results in hard-to-use API

    Using class and `+` instead of `.`-chained builder for plot composition results in hard-to-use API

    Because of operator precedence, the used class approach for geoms (such as geomBar) fails to provide a convenient syntax when showing a plot. It's a confusing mix of ., +, as well as round and curly brackets:

    Example

    // letsplot
    (df.letsPlot{ x = "status" } + geomBar ()).show()
                
    // kravis for comparison
    df.plot(x="status").geomBar().show()
    

    By using a builder approach and using . for chaining (as we do in most other kotlin apis including kotlin-dataframe, a more user-friendly API experience would be possible.

    opened by holgerbrandl 4
  • Is there a feature for displaying images on every bar from geomBar()?

    Is there a feature for displaying images on every bar from geomBar()?

    I'm new to data analysis and I started out with lets-plot for data visualization!

    Basically I'm trying to find a way to add images in geomBar(), it could be an image on the bottom bar or even extended through all the bar or something like that. The main purpose is to make it more beautiful and easier to catch the report at first instead of reading a text.

    But I can't find that feature available there, I've tried with geomImage() but I'm not sure if that's the feature to use, would appreciate any guidance or know if there are plans in the future for adding it

    opened by robercoding 5
Releases(v4.2.0)
  • v4.2.0(Dec 30, 2022)

    [4.2.0] - 2022-12-29

    Added

    Changed

    • Upgraded Lets-Plot version to 3.0.0 (was 2.5.1).
    • Java/Swing platf.: Apache Batik upgraded to v.1.16 [#624], [LPK #140].
    • The default size is increased for the plot title and decreased for the caption.
    • Upgraded Kotlin version to 1.7.21 (was 1.7.20).

    Fixed

    • Themes: can't change plot background after applying a "flavor" [#623].
    • Layout: uneven left/right, top/bottom plot margins [#625].
    • A plot building error with empty data on various geoms.
    • Precision error in gradient [#634].
    Source code(tar.gz)
    Source code(zip)
  • v4.1.1(Nov 9, 2022)

    [4.1.1] - 2022-11-08

    Added

    • In geomText(), geomLabel():

      • the 'newline' character (\n) now works as line break
      • lineheight aesthetic
      • nudgeX, nudgeY parameters
      • special text alignments (vjust and hjust): "inward" and "outward"

      See: example notebook.

    • vjust parameter in positionStack() and positionFill().

      See: example notebook.

    Changed

    • Deprecated API:

      • positionStack, new usage: positionStack()
      • positionFill, new usage: positionFill()
    • geomBoxplot(): default value for parameter whiskerWidth is 0.5.

    • Upgraded Kotlin version to 1.7.20 (was 1.6.21).

    • Upgraded Lets-Plot version to 2.5.1 (was 2.5.0).

      See Lets-Plot What is new in 2.5.1 for more details.

    Fixed

    • elementBlank() has no effect in theme legendTitle [#608].
    • Tooltip: different formats for same aesthetic Y [#579].
    • Positioning with "constant" x/y doesn't work on axis with log10 transform [#618].
    • Positional "constant" doesn't honor axis limits [#619].
    • Several issues leading to crush in Swing/Batik apps. Related to [discussions]
    • Text labels got trimmed occasionally, when symbols -, /, \ or | present.
    Source code(tar.gz)
    Source code(zip)
  • v4.1.0(Sep 30, 2022)

    [4.1.0] - 2022-09-30

    Added

    • New theme: themeBW().

      See: example notebook.

    • Color schemes (flavors) applicable to existing themes:

      • flavorDarcula()
      • flavorSolarizedLight()
      • flavorSolarizedDark()
      • flavorHighContrastLight()
      • flavorHighContrastDark()

      See: example notebook.

    • Viridis color scales: scaleColorViridis(), scaleFillViridis().

      See: example notebook.

    • New parameters in theme's elementText():

    • Parameter whiskerWidth in geomBoxplot().

      See: example notebook.

    • New geometry geomLabel().

      See: example notebook.

    Changed

    Fixed

    • Density and area geoms: preserve the z-order when grouping [#552].
    • Boxplot, violin, crossbar: position dodge width=0.95 should be used by default [#553].
    • Unclear size unit of width [#589].
    • No tooltips for geomBoxplot with zero height [#563].
    • geomText: wrong label alignment with hjust 0 and 1 [#592].
    • Documentation for the breaks parameter in scales [#507]
    Source code(tar.gz)
    Source code(zip)
  • v4.0.0(Jul 25, 2022)

    [4.0.0] - 2022-07-25

    BREAKING CHANGES: Due to refactorings performed in the source code, the v4.0.0 is no longer backward compatible with earlier versions of the Lets-Plot Kotlin API.

    Changed

    • All previously deprecated API were removed.
    • The prefix "org" was added to all package names in the project.
    • Some API elements were moved from package org.jetbrains.letsPlot to a more specific subpackages:
      • Plot theme elements were moved to subpackage themes
      • Coordinate system functions were moved to subpackage coord
      • Position adjustment functions were moved to subpackage pos
    • Deprecated API:
      • Position adjustment constants: identity, stack, fill, dodge, nudge and jitterdodge (defined in the Pos object), are now deprecated in favor of the correspondent top level elements defined in the (new) org.jetbrains.letsPlot.pos package: positionIdentity, positionStack, positionFill, positionDodge(), positionNudge() and positionJitterDodge().

    Migrating to 4.0.0

    In Kotlin project

    • Update all import statements: import jetbrains.letsPlot..import org.jetbrains.letsPlot..
    • In all places in your project where the code needs to be updated, IntelliJ will show you a deprecation WARNING and will offer to fix this automatically.

    In Jupyter notebook

    • As soon as you start using 4.0.0 in you notebook, the only thing you will want to do is to manually replace all deprecated Pos.abc expressions with their new equivalents:
      • Pos.identitypositionIdentity
      • Pos.stackpositionStack
      • Pos.fillpositionFill
      • Pos.dodgepositionDodge()
      • Pos.nudgepositionNudge()
      • Pos.jitterdodgepositionJitterDodge()

    NOTE: If your notebook also uses another Kotlin library which depends on an older version of Lets-Plot, then the classloader may refuse to load classes from both libraries. If this is the case, then you will want to do NOT update your notebook to Lets-Plot v4.0.0 as yet:

    • Make sure your notebook is not using the %useLatestDescriptors line magic
    • Make sure you are using Kotlin Jupyter Kernel version 0.11.0.95 (or earlier), which bundles a previous version of Lets-Plot.
    Source code(tar.gz)
    Source code(zip)
  • v3.3.0(Jun 27, 2022)

    [3.3.0] - 2022-06-27

    Added

    • Global theme configuring with LetsPlot.theme property.

      See: example notebook.

    • Quantile-Quantile (Q-Q) plot:

      • geometries:
        • geomQQ()
        • geomQQLine()
        • geomQQ2()
        • geomQQ2Line()
      • stats:
        • statQQ()
        • statQQLine()
        • statQQ2()
        • statQQ2Line()
      • quick Q-Q: qqPlot()

      See: example notebook.

    • Marginal plots: the ggmarginal() function.

      See: example notebook.

    • Parameter orientation in geoms: bar, boxplot, density, histogram, freqpoly, smooth, violin.

      See: example notebook.

    • New in plot theme:

      • face parameter in elementText().

        See: example notebook.

      • panelBorder parameter in theme() [#542].

        See: example notebook.

      • Tooltip theme options, new parameters in theme():

        • tooltip - tooltip rectangle options;
        • tooltipText, tooltipTitleText - tooltip text options;
        • axisTooltipText, axisTooltipTextX, axisTooltipTextY - axis tooltip text options.

        See: example notebook.

    • scaleColorGradientN() and scaleFillGradientN() functions [#504].

      See: example notebook.

    • kotlinx.datetime support.

    • arrow parameter in geomSegment - specification for arrow heads, as created by arrow() function.

    Changed

    • Potentially breaking change: deprecation level for all deprecated API raised to the ERROR level.
    • geomImage() removed as it is not yet production ready.
    • Default sampling type for geom_violin switched from systematic to pick.

    Fixed

    • Labels out of plot when axisTextY="blank" [#525].
    • Outliers are not shown when boxplot' alpha=0.
    • JFX rendering issue that causes tooltips to stuck [#539].
    • Support trim parameter in density and ydensity stats [#62].
    • geom_violin: add missing parameters kernel, bw, adjust, n, fs_max to signature and docstring.
    Source code(tar.gz)
    Source code(zip)
  • v3.2.0(Mar 29, 2022)

    [3.2.0] - 2022-03-29

    Added

    • New geometries:

      • geomViolin()

      See: example notebook.

      • geomDotplot()

      See: example notebook.

      • geomYDotplot()

      See: example notebook.

    • Plot subtitle and caption: subtitle parameter in ggtitle() and labs(), caption parameter in labs(), plotSubtitle and plotCaption parameters in theme().

      See: example notebook.

    • Multi-line labels: The 'newline' character (\n) now works as line break in plot title, subtitle and caption, in legend's title and in tooltips.

    • In tooltip customization API: the title() option defines a tooltip "title" text which will always appear above the rest of the tooltip content.

      See: example notebook.

    • Parameter scales in facetGrid()/facetWrap() [#451, #479].

      See: example notebook.

    Changed

    • New tooltip style: rounded corners, bold label, colored marker inside the tooltip.
    • Deprecated tooltip customization API: function color() will be removed in one of the future releases.
    • 'Auto shrink': plots automatically shrink when necessary to fit width of the output (notebook) cell [#488].

    Fixed

    • Automatic detection of DateTime series [#99].
    • Too limited mapping options in GenericAesMapping [#82]
    • scaleColorManual Divide by Zero with 1 mapping [#506].
    • LinearBreaksHelper$Companion.computeNiceBreaks out of memory error [#105].
    • CVE-2021-23792 in org.jetbrains.lets-plot:[email protected] [#497].
    • Fix tooltips for geom_histogram(stat='density').
    • The axis tooltip overlaps the general tooltip [#515].
    • The multi-layer tooltip detection strategy will only be used if more than one layer provides tooltips.
    Source code(tar.gz)
    Source code(zip)
  • v3.1.1(Dec 13, 2021)

    [3.1.1] - 2021-12-13

    Added

    • scaleXTime() and scaleYTime().

      See: example notebook.

    • plotBackground, legendBackground parameters in theme() [#485].

    • axisOntop, axisOntopX, axisOntopY parameters in theme()

    Fixed

    • It should automatically stringify enums [#97].
    • Coord system limits do not work with x/y scale with transform [#474].
    • Provide 0-23 hour formatting [#469].
    • No tooltip shown when I'm trying to add an empty line [#382].
    • coord_fixed() should adjust dimensions of "geom" panel accordingly [#478].
    • The tooltip dependence on number of factors works separately by layers [#481].
    • Tooltip on y-axis looks wrong [#393].
    • Is kotlin-reflect really needed for lets-plot? [#471].
    Source code(tar.gz)
    Source code(zip)
  • v3.1.0(Nov 5, 2021)

    [3.1.0] - 2021-11-05

    Added

    • coordFlip().

      See: example notebook .

    • Date-time formatting support:

      • using date-time format pattern in tooltip format();
      • date/time scales apply date-time formatting to the breaks.

      See Out[7, 8, 10] in the example notebook .

    • Pre-configured themes:

      • Standard ggplot2 themes: themeGrey(), themeLight(), themeClassic(), themeMinimal();
      • Other themes: themeMinimal2() - the default theme, themeNone().
    • Theme modification: more parameters were added to the theme() function.

      See: example notebook.

    Note: fonts size, family and face still can not be configured.

    • CorrPlot() function now also accepts pre-computed correlation coefficients.

    • Kotlin/JS IR: xxx.klib artifacts are now available.

      See: sample Kotlin/JS IR app

    Changed

    • The size of fonts on plot was slightly increased all across the board.
    • The default plot size was increased by 20%, it's now 600x400 px.
    • Deprecated API: all Theme.xxxBlank() functions. Please use corresponding parameters in theme().

    Fixed

    • Ordering facets - the "order" value 0 disables facet ordering [#454].
    • Tooltips for discrete variables: add the dependence of the tooltip on the number of factors. The X-axis tooltip is always shown for discrete data.
    • Unreadable breaks on axis [#430].
    Source code(tar.gz)
    Source code(zip)
  • v3.0.2(Aug 17, 2021)

    [3.0.2] - 2021-06-09

    Added

    • Ordering categories:

      New parameters added to the asDiscrete() function:

      • orderBy - name of the variable by which the ordering will be performed;
      • order - ordering direction: 1 for ascending direction and -1 for descending (default).

      See: as_discrete.

    Changed

    Source code(tar.gz)
    Source code(zip)
  • v3.0.1(Jun 9, 2021)

    [3.0.1] - 2021-06-09

    Added

    • The 'format' parameter in all scales [76].

    Changed

    • Upgraded kotlinx.html version to 0.7.3 (was 0.7.2)

    In JVM projects it's no longer necessary to add https://maven.pkg.jetbrains.space/public/p/kotlinx-html/maven repository to the project configuration.

    Fixed

    • Multilayer plots are corrupted [#385].
    • Import "lets-plot-common" transitively [#78]
    Source code(tar.gz)
    Source code(zip)
  • v3.0.0(Jun 4, 2021)

    [3.0.0] - 2021-06-04

    Added

    • In tooltip customization API:

      • layerTooltips(variables) - the new parameter variables defines a list of variable names, which values will be placed in the general multiline tooltip. See: Tooltip Customization.
    • lets-plot-mini-apps GitHub repository containing examples of using the Lets-Plot Kotlin API in JVM and Kotlin-JS projects.

    Changed

    • [BREAKING CHANGE]: The CDN for delivering the Lets-Plot JavaScript library is now JSDELIVR (was CDNJS).

      New URLs:

      • Lets-Plot v2.0.3: https://cdn.jsdelivr.net/gh/JetBrains/[email protected]/js-package/distr/lets-plot.min.js
      • The latest version: https://cdn.jsdelivr.net/gh/JetBrains/lets-plot/js-package/distr/lets-plot.min.js
    • The project has been converted to a "multiplatform" project targeting JVM and JS platforms.

      To use Lets-Plot Kotlin API in your project, include dependencies:

      • JVM: implementation "org.jetbrains.lets-plot:lets-plot-kotlin-jvm:3.0.0"
      • JS: implementation "org.jetbrains.lets-plot:lets-plot-kotlin-js:3.0.0"

      See README_DEV.md for more details.

    • [BREAKING CHANGE] The JVM artifact lets-plot-kotlin-api is no longer deployed: replaced with the equivalent lets-plot-kotlin-jvm.

    • The artifact lets-plot-kotlin-api-kernel renamed to lets-plot-kotlin-kernel (this change only concerns Kotlin Jupyter Kernel)

    Fixed

    • Poor font rendering in Swing/Batik. Related to: [#364]
    • Exclude slf4j implementation from lets-plot-common [#374]
    • geom_boxplot: should be possible to create boxplot without specifying x-series [#325]
    • geom_hline: graph plotted outside of coordinate plane visible part [#334]
    • Draw geometry only once if layer has no aes mapping specified [#73]
    • Can't build plot: "Uncaught SyntaxError: Unexpected string" in a console [#371]
    Source code(tar.gz)
    Source code(zip)
  • v2.0.1(Apr 19, 2021)

    [2.0.1] - 2021-04-19

    Changed

    • [BREAKING CHANGE]: The groupId of all maven artifacts is now "org.jetbrains.lets-plot" (was " org.jetbrains.lets-plot-kotlin")
    • Built with Lets-Plot v2.0.2 (was v2.0.2).
    • All snake_case symbols were deprecated and replaced with equivalent camelCase symbols [#53].
    • Maven artifacts published to Maven Central (due to shutting down of Bintray, JCenter)
    Source code(tar.gz)
    Source code(zip)
  • v1.3.0(Mar 23, 2021)

    [1.3.0] - 2021-03-22

    Added

    • facet_wrap() function.

    • in facet_grid() function:

      • Ascending/descending ordering of faceting values.
      • Formatting of faceting values.

      See: Facets demo

    • The format parameter in positional scales: formatting tick labels on X/Y axis. Supported types are number and date/time.

      Example:

      scale_x_datetime(format="%b %Y")
      scale_x_continuous(format="is {.2f}")
      

      Demo: Formatting demo

      See also: Formatting

    • The guides() function [#52].

    • In tooltip customization API:

      • option color overrides the default tooltip color:
        geom_xxx(tooltips=layer_tooltips().color("red"))
        

      See: Tooltip Customization.

    Changed

    • Built with Lets-Plot v2.0.1 (was v1.5.6).
    • All Java Swing demos were updated to use new plot components (new in Lets-Plot v2.0.1).
    • The "Minimal demo" was updated:

    Fixed

    • show() should actually show a plot [#51]
    • Facet grid truncated in jupyter [#28].

    The majority of fixes in the core Lets-Plot vv 2.0.0, 2.0.1 are also applicable to this release.

    See the Lets-Plot CHANGELOG.md.

    Source code(tar.gz)
    Source code(zip)
  • v1.2.0(Jan 16, 2021)

  • v1.1.0(Nov 20, 2020)

    [1.1.0] - 2020-11-20

    Added

    • GeoTools support (see geotools.md).
    • API for tooltip customization (see tooltips.md).
    • geom_map().
    • labelFormat parameter in geom_text().
    • reverse parameter in scale_x/y_discrete().
    • scale_x_discrete_reversed(), scale_y_discrete_reversed()

    Changed

    • Built with Lets-Plot v1.5.4 (was v1.5.2).

      See Lets-Plot CHANGELOG.md for changes and fixes in 1.5.3, 1.5.4.

    Fixed

    • ggsave() ignores raster format file extension.
    • as_discrete(): if more than one is used in the same mapping block, then all but one of them are ignored.
    Source code(tar.gz)
    Source code(zip)
  • v1.0.0(Aug 13, 2020)

    [1.0.0] - 2020-08-13

    Added

    • The first public release.

    Changed

    • Maven artifact group id has changed.
      • was before: org.jetbrains.lets-plot
      • since now : org.jetbrains.lets-plot-kotlin
    Source code(tar.gz)
    Source code(zip)
  • 0.0.23-SNAPSHOT(Jul 6, 2020)

    [0.0.23-SNAPSHOT] - 2020-07-06

    Added

    • Parameter expand in positional scales.
    • Demo notebooks (GGBunch, Legends & Axis)

    Changed

    • Lets-Plot core version upgraded to 1.4.4-SNAPSHOT - now without dependencies on Kotlin-test, junit.

    Fixed

    • Loading Kotlin-numpy when opening demo notebooks at mybinder.org.
    Source code(tar.gz)
    Source code(zip)
  • 0.0.22-SNAPSHOT(Jul 2, 2020)

    [0.0.22-SNAPSHOT] - 2020-07-01

    Added

    • scale_shape()
    • as_discrete()

    Changed

    • scale_color_grey(), scale_fill_grey() : arguments start, end are now in range [0,1] (before was [0,100]).
    • Parameter mapping (lambda) has been moved to the last position to allow the value to be outside parentheses.
    Source code(tar.gz)
    Source code(zip)
  • 0.0.20-SNAPSHOT(Jun 25, 2020)

    [0.0.20-SNAPSHOT] - 2020-06-25

    Added

    • facet_grid()
    • coord_fixed()
    • labs(), xlab(), ylab()
    • lims(), xlim(), ylim()
    • Geoms:
      • geom_jitter()
      • geom_bin2d(), stat_bin2d()
      • geom_contour(), stat_contour()
      • geom_contourf()
      • geom_density2d(), stat_density2d()
      • geom_density2df()
      • geom_smooth(), stat_smooth()
      • stat_bin()
    • Manual scales:
      • scale_fill_manual(), scale_color_manual()
      • scale_size_manual()
      • scale_shape_manual()
      • scale_linetype_manual()
      • scale_alpha_manual()
    • Identity scales:
      • scale_color_identity(), scale_fill_identity()
      • scale_shape_identity()
      • scale_linetype_identity()
      • scale_alpha_identity()
      • scale_size_identity()
    • Positional scales:
      • scale_x_continuous(), scale_y_continuous()
      • scale_x_discrete(), scale_y_discrete()
    • Brewer color scales:
      • scale_color_brewer(), scale_fill_brewer()

    Changed

    • theme() is now a fluent interface.

    Fixed:

    • theme composition wasn't working.
    Source code(tar.gz)
    Source code(zip)
Owner
JetBrains
JetBrains open source projects
JetBrains
XCore is a Open-Source , simple and lightweight API & Template for Android Apps.

XCore XCore is a Open-Source , simple and lightweight API & Template for Android Apps. Support XCore is compatible with Android Studio & Sketchware Pr

TherionRO 3 Dec 2, 2022
Open source Crypto Currency Tracker Android App made fully in Kotlin

CoinBit CoinBit is a beautiful CryptoCurrency app, completely open sourced and 100% in kotlin. It supports following features Track prices of over 300

Pranay Airan 50 Dec 5, 2022
an open source algorithmic trading framework written in Kotlin for anyone serious about algo-trading

Roboquant Roboquant is an algorithmic trading platform that is fast and flexible while at the same time strives to be easy to use. It is fully open so

Neural Layer 132 Jan 2, 2023
Open-Source Forge 1.8.9 Hypixel Duels bot! Planned to support many modes and written in Kotlin.

This project has been moved to a new repository: [HumanDuck23/duck-dueller-v2](https://github.com/HumanDuck23/duck-dueller-v2) Duck Dueller Are you ti

null 2 Aug 29, 2022
An AutoValue extension that generates binary and source compatible equivalent Kotlin data classes of AutoValue models.

AutoValue Kotlin auto-value-kotlin (AVK) is an AutoValue extension that generates binary-and-source-compatible, equivalent Kotlin data classes. This i

Slack 19 Aug 5, 2022
Demo Spting REST Service on Kotlin. Works with PostgreSQL via Spring Data. Data initialization provided by liquibase

Spring Boot REST API with Kotlin Spring Boot REST API service. Spring Data with PostgreSQL. Data initialization with Liquibase. Swagger UI Reference D

null 0 Jun 10, 2022
Free and open source manga reader for Android.

Build Stable Weekly Preview Contribute Support Server Tachiyomi Tachiyomi is a free and open source manga reader for Android 5.0 and above. Features F

Tachiyomi 20.2k Dec 30, 2022
Free and open source Android app to manage qBittorrent remotely.

qBitController qBitController is a free and open source app for managing qBittorrent remotely. Please note that qBitController is in alpha version. Us

Bartu Özen 12 Dec 25, 2022
Bible Study App, by And Bible Open Source Project

Bible Study App by And Bible Open Source Project Powerful offline Bible Study tool for Android Promovideo See promovideo in Youtube Users Please see t

And Bible 437 Dec 23, 2022
An open source app which can be used to do basic surveys

SurveyApp This is an open source app which can be used to do basic surveys. It supports multiple question types. For demo please check the releases pa

Dhiraj Uchil 0 Dec 9, 2021
Android Open-Source Telematics App with Firebase© integration

Android Open-Source Telematics App with Firebase© integration Description This Telematics App is developed by Damoov and is distributed free of charge

null 0 Jan 14, 2022
OpenAbyss - Open source script for Powbot that crafts runes through the abyss

OpenAbyss Open source script for Powbot that crafts runes through the abyss Feat

null 3 Feb 9, 2022
Kotatsu is a free and open source manga reader for Android platform

Kotatsu is a free and open source manga reader for Android platform. Supports a lot of online catalogues on different languages with filters and search, offline reading from local storage, favourites, bookmarks, new chapters notifications and more features.

null 7 Dec 19, 2022
Detailing about the data provided (Data Visualization Application)

Detailing about the data provided (Data Visualization Application): • In the application, the data provided in the CSV is used for the Scatter plot cr

Neha Sharma 0 Nov 20, 2021
Use Android Data Binding wih Live Data to glue View Model and Android

Gruop-C Spliff Summary Use Android Data Binding wih Live Data to glue View Model and Android. Asynchronous communications implemented with KotlinX Cor

null 2 Nov 21, 2021
A library that extends the existing JDBC API so that data objects can be used as input (to set parameters) and output (from ResultSet's rows).

SqlObjectMapper This is a library that extends the existing JDBC API so that data objects can be used as input (to set parameters) and output (from Re

Qualified Cactus 2 Nov 7, 2022
intera.kt is a Kotlin library for interacting with the Discord Interactions API through a gateway service or a REST API.

?? Overview ⚠️ WARNING: intera.kt is a work in progress. It is not yet ready for use. You may encounter bugs and other issues, but please report if yo

Pedro Henrique 1 Nov 30, 2021