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

Violin plot (a kind of) #1520

Merged
merged 4 commits into from May 24, 2019
Merged

Violin plot (a kind of) #1520

merged 4 commits into from May 24, 2019

Conversation

iliatimofeev
Copy link
Contributor

@iliatimofeev iliatimofeev commented May 20, 2019

Violinplot

This example shows how to make a king of a Violinplot.

visualization - 2019-05-21T021104 068

@iliatimofeev
Copy link
Contributor Author

with resolving of vega/vega-lite#4939 I guess it could be simplified.

@jakevdp
Copy link
Collaborator

jakevdp commented May 22, 2019

Should we wait for that update, or merge as-is?

Copy link
Collaborator

@jakevdp jakevdp left a 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

source = data.cars.url

violinplot = alt.Chart(source).transform_filter(
alt.FieldGTPredicate(field='Miles_per_Gallon',gt=0)
Copy link
Collaborator

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

).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'
Copy link
Collaborator

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@iliatimofeev
Copy link
Contributor Author

Should we wait for that update, or merge as-is?

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)

@jakevdp jakevdp merged commit c7cb3f6 into vega:master May 24, 2019
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.

None yet

2 participants