Skip to content

Add kde support for hist - #795

Draft
gepcel wants to merge 9 commits into
Ultraplot:mainfrom
gepcel:kde-for-histplot
Draft

Add kde support for hist#795
gepcel wants to merge 9 commits into
Ultraplot:mainfrom
gepcel:kde-for-histplot

Conversation

@gepcel

@gepcel gepcel commented Aug 14, 2026

Copy link
Copy Markdown
Collaborator

Are you instrested in adding a kde support for hist for now?

Should close #794

@codecov

codecov Bot commented Aug 14, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 96.66667% with 2 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
ultraplot/axes/plot.py 90.00% 2 Missing ⚠️

📢 Thoughts on this report? Let us know!

@cvanelteren

Copy link
Copy Markdown
Collaborator

This would require a few extra things. First an optional dependency in the install for scipy; a fallback + handling in the code added here and third tests.

@gepcel

gepcel commented Aug 15, 2026

Copy link
Copy Markdown
Collaborator Author
  • First an optional dependency in the install for scipy;
  • a fallback + handling in the code added here and
  • third tests.

3/3 are done.

@cvanelteren
cvanelteren marked this pull request as draft August 15, 2026 07:54
@gepcel
gepcel requested a review from cvanelteren August 16, 2026 23:51
@cvanelteren

Copy link
Copy Markdown
Collaborator
  • First an optional dependency in the install for scipy;

    • a fallback + handling in the code added here and

    • third tests.

2/3 are done. I don't know how to add fallback handling, raise an error if scipy is not installed? And I'm not sure if it's good practise to put one assert in one method or it's ok to put them together.

It's fine if you take this over, or you can leave comments about what else to do, and how to do it.

shouldn't the second bullet be done?

@gepcel

gepcel commented Aug 16, 2026

Copy link
Copy Markdown
Collaborator Author

I don't know what you mean by "fallback handling". Maybe you can explain a little or you can take it over.

@cvanelteren

Copy link
Copy Markdown
Collaborator

What I would do is make the scipy import optional and do a try except block and produce a warning if it is not installed; fallback may have been wrongly stated as this would imply we provide the kde itself

@gepcel

gepcel commented Aug 17, 2026

Copy link
Copy Markdown
Collaborator Author

What I would do is make the scipy import optional and do a try except block and produce a warning if it is not installed; fallback may have been wrongly stated as this would imply we provide the kde itself

Ok, I'll take a look, and add this. I actually did do a research how to calculate kde using pure numpy.

@gepcel

gepcel commented Aug 17, 2026

Copy link
Copy Markdown
Collaborator Author

Now you can review.

There's also from scipy.stats import gaussian_kde in def _apply_ridgeline and tests about ridgeline, without warnings.

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.

Suggest to add kde to histogram plot.

2 participants