-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
feat(experiments): violin plots #28073
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR Summary
This PR enhances experiment result visualization by replacing rectangular bars with violin plots to better represent probability distributions in the DeltaChart component.
- Added
generateViolinPath
function in/frontend/src/scenes/experiments/MetricsView/DeltaChart.tsx
using normal distribution approximation for SVG path generation - Implemented gradient fills in violin plots to visually distinguish positive/negative regions
- Simplified delta markers from rectangles to lines for cleaner visualization
- Increased default bar height from 8px to 10px to accommodate violin plot shape
- Added dynamic width scaling based on bar height to maintain proportional violin shapes
1 file(s) reviewed, 1 comment(s)
Edit PR Review Bot Settings | Greptile
<linearGradient | ||
id={`gradient-${metricIndex}-${variant.key}`} | ||
x1="0" | ||
x2="1" | ||
y1="0" | ||
y2="0" | ||
> | ||
{lower < 0 && upper > 0 ? ( | ||
<> | ||
<stop offset="0%" stopColor={COLORS.BAR_NEGATIVE} /> | ||
<stop | ||
offset={`${(-lower / (upper - lower)) * 100}%`} | ||
stopColor={COLORS.BAR_NEGATIVE} | ||
/> | ||
<stop | ||
offset={`${(-lower / (upper - lower)) * 100}%`} | ||
stopColor={COLORS.BAR_POSITIVE} | ||
/> | ||
<stop | ||
offset="100%" | ||
stopColor={COLORS.BAR_POSITIVE} | ||
/> | ||
</> | ||
) : ( | ||
<stop | ||
offset="100%" | ||
stopColor={ | ||
upper <= 0 | ||
? COLORS.BAR_NEGATIVE | ||
: COLORS.BAR_POSITIVE | ||
} | ||
/> | ||
)} | ||
</linearGradient> | ||
</defs> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
style: Multiple gradient definitions with the same stops are created for each variant. Consider moving the gradient definition outside the variant loop for better performance.
📸 UI snapshots have been updated3 snapshot changes in total. 0 added, 3 modified, 0 deleted:
Triggered by this commit. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✨
This reverts commit 12360ea.
60f7e4b
to
23b59ee
Compare
Size Change: 0 B Total Size: 1.16 MB ℹ️ View Unchanged
|
Problem
We are currently showing rectangular bars for the credible interval distribution. This does not give an accurate representation of the underlying data. It is much more likely that the value is close to the center than towards the tails.
Changes
Use violin plots as they better represent the underlying probability distribution of the data. It becomes more visible that the value is likely to be closer to the center.
Before:

After:

Tooltip:

How did you test this code?
👀