altair-viz / altair_widgets Goto Github PK
View Code? Open in Web Editor NEWInteractive data exploration with Altair
License: BSD 3-Clause "New" or "Revised" License
Interactive data exploration with Altair
License: BSD 3-Clause "New" or "Revised" License
via interact_with(df, initial: list[Union(str, dict)])
. Each element in initial
can either be a str representing the column name or a dict representing the settings.
It'd be nice to have an option for linear/log scales.
This will likely using
Chart(df).mark_point().encode(x=X('col', aggregate='mean', type='quantitive')
instead of Chart(df).mark_point().encode(x='mean(col:Q)')
.
This is mentioned in https://altair-viz.github.io/documentation/encoding.html#encoding-shorthands
...with Chart.to_altair
On my machine, updating takes 2.4 seconds. This happens anytime a button is pressed. This is really annoying.
...because they don't read the current encoding settings in. They should read in the appropriate value from self.settings
and set menu.value
to that appropriate value.
This is related to the issue of showing the default value of these parameters.
This is a significant user interface issue -- I ran into an issue where I changed the scale to "log" and wanted to go back to "linear"... so I kept on selecting "linear". This didn't have any effect because the callback is only called when menu.value
changes.
When running
interact_with(iris)
I get the following output
TypeError Traceback (most recent call last)
<ipython-input-1-1ad553e9f0bc> in <module>()
8
9 from altair_widgets import interact_with
---> 10 interact_with(iris)
~/code/perso/notebooks/data-science-exercises/venv/lib/python3.7/site-packages/altair_widgets/widget.py in interact_with(df, ndims, **kwargs)
26
27 """
---> 28 return Interact(df, ndims=ndims, **kwargs)
29
30
~/code/perso/notebooks/data-science-exercises/venv/lib/python3.7/site-packages/altair_widgets/widget.py in __init__(self, df, ndims, show)
56 display(self.controller)
57
---> 58 self.plot(show=show)
59
60 def _show_advanced(self, button, disable=1):
~/code/perso/notebooks/data-science-exercises/venv/lib/python3.7/site-packages/altair_widgets/widget.py in plot(self, show)
168 mark = mark_opts.pop('mark')
169 Chart_mark = getattr(altair.Chart(self.df), mark)
--> 170 self.chart = Chart_mark(**mark_opts).encode(**kwargs)
171 if show and self.show:
172 clear_output()
~/code/perso/notebooks/data-science-exercises/venv/lib/python3.7/site-packages/altair/vegalite/v2/api.py in encode(self, *args, **kwargs)
1238 if condition is not Undefined:
1239 obj['condition'] = _wrap_in_channel_class(condition, prop)
-> 1240 kwargs[prop] = _wrap_in_channel_class(obj, prop)
1241
1242
~/code/perso/notebooks/data-science-exercises/venv/lib/python3.7/site-packages/altair/vegalite/v2/api.py in _wrap_in_channel_class(obj, prop)
1214 return [_wrap_in_channel_class(subobj, prop) for subobj in obj]
1215
-> 1216 if 'value' in obj:
1217 clsname += 'Value'
1218
TypeError: argument of type 'NoneType' is not iterable
If I then click on the button "Options", I get additional errors:
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
~/code/perso/notebooks/data-science-exercises/venv/lib/python3.7/site-packages/altair_widgets/widget.py in _show_advanced(self, button, disable)
84 c.observe(self._update, names='value')
85
---> 86 visible = self.controller.children[row].children[-1].visible
87 self.controller.children[row].children[disable].disabled = not visible
88 self.controller.children[row].children[-1].visible = not visible
AttributeError: 'VBox' object has no attribute 'visible'
i.e., have a tool that integrates with df[df.field == value]
.
I copied exactly the example, but it's not working. Error thrown is TypeError: argument of type 'NoneType' is not iterable
To start with, we could just do smoke tests (i.e. run the main function and make sure it doesn't error). It might be worth investigating how ipywidgets tests things, to see if we can go a bit deeper.
When I launch altair_widgets (I tried the iris example posted here on github) I get the following error:
"TraitError: The 'x' trait of an Encoding instance must be a X, but a value of class 'NoneType' (i.e. None) was specified."
If I select an x encoding I get the same message for y and then for colour.After selecting 3 encodings, I get a visualization, but then I cannot modify anything anymore.
Any ideas?
Many thanks!
This is a simplification, and will allow easier testing.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.