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
Violin plot (a kind of) #1520
Violin plot (a kind of) #1520
Conversation
with resolving of vega/vega-lite#4939 I guess it could be simplified. |
Should we wait for that update, or merge as-is? |
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.
Looks great! Some minor comments
altair/examples/violine_plot.py
Outdated
source = data.cars.url | ||
|
||
violinplot = alt.Chart(source).transform_filter( | ||
alt.FieldGTPredicate(field='Miles_per_Gallon',gt=0) |
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.
I prefer using the form alt.datum.Miles_per_Gallon > 0
altair/examples/violine_plot.py
Outdated
).transform_bin( | ||
['bin_max', 'bin_min'], field='Miles_per_Gallon', bin=alt.Bin(maxbins=20) | ||
).transform_calculate( | ||
binned='(datum["bin_max"]+datum["bin_min"])/2' |
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.
I prefer binned=(alt.datum.bin_max + alt.datum.bin_min) / 2
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.
done
Seems like density plots are quite requested (#1494, #1029) and with new impute transform we can somehow visualize density. I don't how (and when) vega/vega-lite#4939 will be resolved it may be that vega/vega-lite#3442 will be resolved first. I opend #1529 as reminder (if you assign it to me, I'll fix it) |
Violinplot
This example shows how to make a king of a Violinplot.