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

Add energy plot #108

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

Add energy plot #108

wants to merge 3 commits into from

Conversation

aloctavodia
Copy link
Contributor

@aloctavodia aloctavodia commented Nov 18, 2024

schools = azb.load_arviz_data('centered_eight')
azp.plot_energy(schools)

energy_kde

azp.plot_energy(schools, kind="ecdf")

energy_ecdf

This is not working, because we have a np.nan value

azp.plot_energy(schools, kind="hist")

📚 Documentation preview 📚: https://arviz-plots--108.org.readthedocs.build/en/108/

@codecov-commenter
Copy link

codecov-commenter commented Nov 18, 2024

Codecov Report

Attention: Patch coverage is 18.75000% with 26 lines in your changes missing coverage. Please review.

Project coverage is 85.28%. Comparing base (838fa5e) to head (6a94eb4).

Files with missing lines Patch % Lines
src/arviz_plots/plots/energyplot.py 16.12% 26 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #108      +/-   ##
==========================================
- Coverage   86.03%   85.28%   -0.75%     
==========================================
  Files          24       25       +1     
  Lines        2843     2875      +32     
==========================================
+ Hits         2446     2452       +6     
- Misses        397      423      +26     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

src/arviz_plots/plots/energyplot.py Outdated Show resolved Hide resolved
src/arviz_plots/plots/energyplot.py Outdated Show resolved Hide resolved
pc_kwargs=pc_kwargs,
)

plot_collection.add_legend("energy", loc="outside right upper")
Copy link
Member

Choose a reason for hiding this comment

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

I opened an issue for this, it won't work across backends yet: #109

return plot_collection


def _get_energy_ds(dt):
Copy link
Member

Choose a reason for hiding this comment

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

I'll try to look at https://docs.xarray.dev/en/stable/generated/xarray.DataArray.diff.html and see if we can make all this a bit more direct. I think it will also break when getting transposed inputs

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have to admit, that I spent more than I expected to write this part (and try alternatives) :-)

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.

3 participants