Skip to content

Add Violin Plot #296

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

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

The-Broken-Keyboard
Copy link
Contributor

@The-Broken-Keyboard The-Broken-Keyboard commented Jun 27, 2025

Work in progress (few components remaining)


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

@The-Broken-Keyboard The-Broken-Keyboard marked this pull request as draft June 27, 2025 01:56
@codecov-commenter
Copy link

Codecov Report

Attention: Patch coverage is 13.42282% with 129 lines in your changes missing coverage. Please review.

Project coverage is 85.71%. Comparing base (d78bc97) to head (a65338e).

Files with missing lines Patch % Lines
src/arviz_plots/plots/violin_plot.py 11.30% 102 Missing ⚠️
src/arviz_plots/visuals/__init__.py 18.18% 27 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #296      +/-   ##
==========================================
- Coverage   87.82%   85.71%   -2.12%     
==========================================
  Files          44       45       +1     
  Lines        5102     5249     +147     
==========================================
+ Hits         4481     4499      +18     
- Misses        621      750     +129     

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@aloctavodia aloctavodia changed the title Adds Violine Plot Add Violin Plot Jun 27, 2025
Copy link
Member

@OriolAbril OriolAbril left a comment

Choose a reason for hiding this comment

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

As it is a draft, I skimmed to get the general idea and try and flag places where you might be creating too much work or backing into a corner

Comment on lines +242 to +245
# flip x and y coordinates
density_flipped = left_density.rename({"plot_axis": "flipped_plot_axis"})
density_flipped = density_flipped.assign_coords(flipped_plot_axis=["y", "x"])
density_flipped = density_flipped.rename({"flipped_plot_axis": "plot_axis"})
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
# flip x and y coordinates
density_flipped = left_density.rename({"plot_axis": "flipped_plot_axis"})
density_flipped = density_flipped.assign_coords(flipped_plot_axis=["y", "x"])
density_flipped = density_flipped.rename({"flipped_plot_axis": "plot_axis"})
# flip x and y coordinates
density_flipped = left_density.sel(plot_axis=["x", "y"]).assign_coords(plot_axis=["y", "x"])

This should achieve the same, and adding the .sel will make it work even if for some reason the initial dataarray already has y, x as coord values

Comment on lines +271 to +274
# flip x and y coordinates
density_flipped = right_density.rename({"plot_axis": "flipped_plot_axis"})
density_flipped = density_flipped.assign_coords(flipped_plot_axis=["y", "x"])
density_flipped = density_flipped.rename({"flipped_plot_axis": "plot_axis"})
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
# flip x and y coordinates
density_flipped = right_density.rename({"plot_axis": "flipped_plot_axis"})
density_flipped = density_flipped.assign_coords(flipped_plot_axis=["y", "x"])
density_flipped = density_flipped.rename({"flipped_plot_axis": "plot_axis"})
density_flipped = left_density.sel(plot_axis=["x", "y"]).assign_coords(plot_axis=["y", "x"])
density_flipped.loc[{"plot_axis": "x"}] = -density_flipped.sel(plot_axis="x")

You can get the data as negative like so instead of adding an argument to the visual function

"dist",
"credible_interval",
"point_estimate",
"point_estimate_text",
Copy link
Member

Choose a reason for hiding this comment

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

I don't think we'll want the point estimate text in this plot, the other ones can be nice, if you haven't added it yet I don't think it is necessary you do at all

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