Add kde support for hist - #795
Conversation
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
|
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. |
3/3 are done. |
shouldn't the second bullet be done? |
|
I don't know what you mean by "fallback handling". Maybe you can explain a little or you can take it over. |
|
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. |
… and skip 3 tests.
|
Now you can review. |
|
I put some notes down for you to look at! |
This comment was marked as outdated.
This comment was marked as outdated.
| for i in range(data2d.shape[1]): | ||
| _x = data2d[:, i] | ||
| xa = np.linspace(_x.min(), _x.max(), stepsize) | ||
| ya = gaussian_kde(_x)(xa) |
There was a problem hiding this comment.
we would need to forward gaussian_kde kwargs too
There was a problem hiding this comment.
^this still needs to happen
| res[i] = cbook.silent_list("Polygon", sub) | ||
| self._update_guide(res, **guide_kw) | ||
| # add kde line | ||
| if not kde: |
There was a problem hiding this comment.
actually we may just want to move this block out in helpers somewhere and call it from there
| - cftime | ||
| - markdown | ||
| - requests | ||
| - scipy |
There was a problem hiding this comment.
conda does not allow for optional deps we could add this to the pyproject.toml and not bloat conda installs
|
Ah they were pending my bad! |
This comment was marked as outdated.
This comment was marked as outdated.
6ccfbd1 to
2a07f81
Compare
|
The implementation is complete and the code is fairly straightforward. However, I'd like to highlight a few points:
|
|
Feel free to merge |
Can I? I don't see the merge option. The refactor codes are too many, I did some simple tests, seems right. You can merge. Whenever code is refactored to integrate into UltraPlot’s codebase and style, it becomes harder to read. I can only do some tests. |
Are you instrested in adding a kde support for hist for now?
Should close #794