5 ms·
would it be possible to link this up with multiple user selectible legend that then update a table? What I'm thinking is a table with multipl entires, where th
by boromi 6y ago
would it be possible to link this up with multiple user selectible legend that then update a table? What I'm thinking is a table with multipl entires, where the legend on the right of the plot serves specify characterstics in the table. E.g. gender, age group, and then these selections would plot them but also update the table below them?
- sterlinm 6y agoYes it's theoretically possible. I created an example of linking a table to a scatter plot brush selection. That said, I have never been able to get altair/vega-lite to generate a nicely formatted table to my satisfaction. I mostly end up connecting a simpler altair chart without interactions to a dataframe and hook them together using something like ipywidgets, Panel, or streamlit. It would be really nice though to be able to get the table linked to native altair interactions like selection and brushing. https://altair-viz.github.io/gallery/scatter_linked_table.html https://altair-viz.github.io/gallery/scatter_linked_table.ht...
- boromi 6y agoThanks. Yeah that's not quite what I was hoping for, I was actually thinking something closer like the following: https://www.m43lenses.com/ https://www.m43lenses.com/
- sterlinm 6y agoipywidgets + altair could mimic that pretty easily I think since with that example you just want to filter with a bunch of checkmarks/radios/dropdowns on a sidebar and then display a chart and table based on those filters. The place where you start to run into problems is if you want to filter the table based on interactions with the chart. If you're going to use dropdowns and checkboxes to filter the dataframe and the chart then you have a lot of good options.
- boromi 6y agoThanks, I'll check out ipywidgets. So basically use ipwidgets to create the checkmarks/radio/dropdowns. Then hook the database up to altair. I'll play tommorow with altair and ipywidgets and see how I can cook this up. "filter the table based on interactions with the chart" For me all I'd need is a the corresponding datapoint selected to highlight the row.
- MisterBiggs 6y agoI've seen this done by making a fake legend out of a bar chart. As far as I know, there's no way to make an interactive legend in Altair. Personally I would look into plotly / dash for something with interactivity.
- sterlinm 6y agoAltair does have interactive legends actually. But dash is great for more complicated interactions and layouts. Panel, streamlit, and voila are also all potentially useful. https://altair-viz.github.io/gallery/interactive_legend.html https://altair-viz.github.io/gallery/interactive_legend.html https://altair-viz.github.io/user_guide/interactions.html#selection-targets-fields-and-encodings https://altair-viz.github.io/user_guide/interactions.html#se...
- MisterBiggs 6y agoI stand corrected, I may have to revisit Altair. Some of those other options look pretty compelling too I think it's definitely time for something to replace Matplotlib as the go-to for python plotting.
- cycomanic 6y agoWhile I agree with you that matplotlib should be replaced , I see a problem in that almost all these new plotting libraries are focused on plotting statistical type data. While this is obviously a big thing at the moment, more traditional type graphs are often not well catered for by these libraries. For example I work in signal processing and would like good looking line and 3d graphs with easy layout of multiple plots... Matplotlib despite its shortcomings is still the best tool for this.
- prepend 6y agoI think they added this in v4 within the last year. Altair is developing really quickly, and I like that. JVP has been really responsive and it’s amazing how quickly the project is adding features.