Skip to content

Conversation

@vokimon
Copy link
Contributor

@vokimon vokimon commented Dec 9, 2025

This PR adds:

  • HeatMapPlot: a new XY plot that displays Z values in color for evenly X and Y spaced objects.
  • generateHistogram2D: A data preparation functionwhich takes X,Y samples and aggregates the count in discrete X, Y bins.
  • discreteColorScale, linearColorScale, divergentColorScale: A set of convenience color scales to map from values to color and can be used with HeatMapPlot

Before integration i would like to ask you for guidance to adhere to standards in the project and other issues being new to the project but also to kotlin.

Color scales and the histogram are TDD'ed, so they have full testing coverage. HeatMapPlot has no test yet. I would need some help with that if they are required.

The branch currently includes a commit with an example and modifications in the build.gradle that are not intended to be in the final PR but have been useful to user test the whole thing. Indeed it could be nice to have something like that example in the samples repository. How to proceed?

imatge

@vokimon vokimon marked this pull request as draft December 9, 2025 17:56
@vokimon vokimon marked this pull request as ready for review December 9, 2025 17:57
@gsteckman
Copy link
Member

Hi @vokimon, thanks for contributing this, it looks very good. As far as testing the graphical output, there aren't any tests yet. But testing the purely numerical parts is a good idea.

Usually during development what I do is publishToMavenLocal from core, and then use that local version in the samples app and write/update a sample. When I am satisfied with the results I will commit to core, and if publishing a release do that, then update the samples to use the new release. In this case, if you submit a PR for core with the HeatMapPlot and related classes and then another PR for samples, I can publish a dev release of them together.

@vokimon
Copy link
Contributor Author

vokimon commented Dec 14, 2025

I am trying the instructions in the sample repository to build the example but gradle takes the published version of the library without heatMap and even without AxisContent. How do you force gradle to use the local version of the library?

@gsteckman
Copy link
Member

Since 0.11.0-dev.1 has been published to Maven Central, there are 3 steps to take:

  1. Increment the Koalaplot-core version to 0.11.0-dev.2
  2. Build Koalaplot-core with publishToMavenLocal
  3. In Koalaplot-samples, set the dependency on Koalaplot-core to 0.11.0-dev.2

Now when you build koalaplot-samples, it'll pick up your unreleased local version from your local maven repository.

@vokimon
Copy link
Contributor Author

vokimon commented Dec 17, 2025

@gsteckman I just pushed the example into the samples repo. KoalaPlot/koalaplot-samples#7

I also did some changes to this PR:

  • Removed the commits with the example and build files
  • Fixed some latent bugs
  • Abstracted lerp and normalize methods for ClosedRange that simplify the code a lot and also helped me to fix some of the bugs.

Being generic you could use lerp/normalize on other parts of the library doing linear projections.

So now, on my part, the PR is ready, unless you point me out things to fix.

This generic implemantation centralizes domain mapping logic.
Histogram2D: make 2 parameters optional to fullfill <6 mandatory arguments
Supress Magic numbers
Supress multiple continue
ktlint Formatting
It avoids multiple continue linter error by turning them
into returns in the extracted function.
Copy link
Member

@gsteckman gsteckman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your contribution!

@gsteckman gsteckman merged commit c00bb48 into KoalaPlot:main Dec 26, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants