Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exporters.Plotting: ScottPlot histogram export #2711

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

bclehmann
Copy link
Contributor

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:
ScottPlotBench Benchmarks DataLogger-20250323-182101-DataLogger-histogramplot

On test data it looks more like this:
MockSummary-N9-JobBaseline_MethodsJobs-histogramplot

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/

@bclehmann
Copy link
Contributor Author

FWIW I've began work on KDE in ScottPlot, I expect to have a PR up this evening and then we'll see if the eponymous Scott wants it in the library:

image

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.

1 participant