Replies: 4 comments
-
We can likely get this to work with jupyter's new output updating...
…On Mon, Oct 23, 2017 at 3:54 PM, Sam Lau ***@***.***> wrote:
Hey all, I'd like to altair to make interactive demos for teaching data
science concepts. For teaching purposes, it would be really helpful to have
some way of updating a chart's dataset after the initial render.
For example, we'd like to create a histogram of sample means becoming
narrower as the sample size increases. We can do this using ipywidgets, but
as described in #333 <#333>
the chart flickers significantly. My hope is that just focusing on dataset
changes rather than chart updates in general will be better scoped and
easier to implement (I can offer my own time to work on this).
Based on Vega-lite's view.change method
<https://vega.github.io/vega/docs/api/view/#view_change>, I'm imagining
something like:
data = alt.Data(values=[{'x': 'A', 'y': 5},
{'x': 'B', 'y': 3},
{'x': 'C', 'y': 6},
{'x': 'D', 'y': 7},
{'x': 'E', 'y': 2}])
chart = alt.Chart(data).mark_bar().encode(
x='x:O', # specify ordinal data
y='y:Q', # specify quantitative data
)
# later...
chart.change(alt.ChangeSet().insert({'x': 'F', 'y': 1}))
# and using ipywidgets:def update(new_height):
chart.change(alt.ChangeSet().insert({'x': 'F', 'y': new_height}))
interact(update, new_height=(1, 10))
cc @CalebS97 <https://github.com/calebs97>
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#426>, or mute the thread
<https://github.com/notifications/unsubscribe-auth/AABr0N-HPK1MyQx3egOxXX5a7XVfIuXcks5svRkmgaJpZM4QDm1Z>
.
--
Brian E. Granger
Associate Professor of Physics and Data Science
Cal Poly State University, San Luis Obispo
@ellisonbg on Twitter and GitHub
bgranger@calpoly.edu and ellisonbg@gmail.com
|
Beta Was this translation helpful? Give feedback.
0 replies
-
I actually stumbled upon this needs. Would this feature be considered in the updates in the future? Thanks in advance! |
Beta Was this translation helpful? Give feedback.
0 replies
-
This would definitely be considered; what it lacks right now is a motivated person to work on it. Are you interested? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hey all, I'd like to use
altair
to make interactive demos for teaching data science concepts. For teaching purposes, it would be really helpful to have some way of updating a chart's dataset after the initial render.For example, we'd like to show a single histogram of sample means becoming narrower as the sample size #increases. We can do this using ipywidgets, but as described in #333 the chart flickers significantly. My hope is that just focusing on dataset changes rather than chart updates in general will be better scoped and easier to implement (I can offer my own time to work on this).
Based on Vega-lite's
view.change
method, I'm imagining something like:Any opinions on this? I'm peeking at the
altair
andipyvega
code and this appears doable but not super easy. Maybe you'll have a better idea of how hard this will be.cc @CalebS97
Beta Was this translation helpful? Give feedback.
All reactions