Exporters.Plotting: ScottPlot histogram export#2711
Open
bclehmann wants to merge 3 commits intodotnet:masterfrom
Open
Exporters.Plotting: ScottPlot histogram export#2711bclehmann wants to merge 3 commits intodotnet:masterfrom
bclehmann wants to merge 3 commits intodotnet:masterfrom
Conversation
Contributor
Author
AndreyAkinshin
requested changes
May 1, 2025
Member
AndreyAkinshin
left a comment
There was a problem hiding this comment.
@bclehmann thanks for the PR! We definitely need a histogram support here, but the current overlapping view looks confusing. Here what I got from ScottPlotExporterTests.HistogramPlots:



For the initial implementation, we need something that presents information in a clearer way.
Contributor
Author
|
Those are all fair comments, I suspect the best move is to go with a density plot like the existing R code. It should be more readable. The support for that has recently been merged into ScottPlot and I suspect there'll be a release soon: ScottPlot/ScottPlot#4869 For what it's worth I'm sorry for the slow response time, I've been moving and been busy with work. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

It's my understanding that the existing R plot exporters includes a density plot, but I don't know what kind of smoothing that goes through. ScottPlot does support calculating this from a histogram but it doesn't support the necessary kernel density estimation. So your options are to either compute the discrete PDF (unlikely to be appropriate unless there's hundreds of bins) or assume a normal distribution (almost certainly not appropriate). And then you can potentially add smoothing on top of that (e.g. turn it into a bezier or compute a moving average).
I figure that a histogram is at least part of the way there, and I might look at adding a KDE implementation into ScottPlot, since it would unlock a few plot types that we've never supported before.
On real data it looks something like this:

On test data it looks more like this:

I'm noticing that the chart is fairly messy, since there are multiple histograms in the same colour (as they're in the same job). Unless I did something wrong while grouping the data, this suggests that either histograms may not be a great option to have enabled by default (if this is typical of real-world usage) or that there might need to be separate test cases which are less busy (if this isn't typical of real-world usage).
This may be unrelated, but I noticed that the R exporter shows multiple plots in one image. This is supported in ScottPlot, so if you want to go that route that is an option. Here's a couple of examples: https://scottplot.net/cookbook/5.0/MultiplotRecipes/