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
Boxplots with filter transform based on selection don't work #2255
Comments
Hi. I ran your boxplot code and checked the browser console and found this warning: If you haven't tried this yet, I think an ok alternative to the dropdown list is to have all 3 metrics as columns like so alt.Chart(metrics).mark_boxplot(size=30).encode(
x='group',
y='value',
color='group',
column='metric'
).properties(width=100) |
Hi @baogianghoangvu, thanks for looking into this. I figured it probably wasn't implemented in vega-lite yet, but I don't know much about JS and I didn't think to check the browser console- I'll remember that next time I have an issue. Your suggestion to use the column channel is a good one, but in my actual use case I have another variable that I'm faceting via columns. I guess I could use the row channel too, but I was trying to keep the chart from getting too busy. |
@carusov This is being tracked in vega/vega-lite#3702 and can become available in Altair after it is implemented in Vega-Lite. |
Hi @joelostblom, is there by any chance an update regarding the interactive boxplot issue? I would like to be able to zoom in on my boxplot but the interactive function does not work, also adding a scale does not give the desired results (scale= {"domain": [0,50]}) |
Hi @devliegherec, this will only be available in Altair after the functionality has been added to Vega-Lite, so please follow vega/vega-lite#3702. Regarding zooming and domain not working, could you create a minimal reproducible example and post your question (ideally on stack overflow tagging it with 'altair') and I will see if there is a workaround? |
Closing this as there is nothing to do on the Altair side of things, when this function is added to VL, it will be in an upcoming Altair release. |
Although boxplots still don't support import altair as alt
from vega_datasets import data
dropdown = alt.binding_select(
options=['Miles_per_Gallon', 'Displacement', 'Weight_in_lbs', 'Acceleration'],
name='X-axis column '
)
xcol_param = alt.param(
value='Miles_per_Gallon',
bind=dropdown
)
alt.Chart(data.cars.url).mark_boxplot().encode(
x=alt.X('x:Q', title=''),
y='Origin:N',
color='Origin:N'
).transform_calculate(
x=f'datum[{xcol_param.name}]'
).add_params(
xcol_param
) |
Thanks for the update @joelostblom. I'm excited about the new features in the coming 5.0 release. I'm a long-time and heavy user of Altair, so I'm very grateful to you and all the contributors for continuing to develop and extend Vega-Altair. |
I'm have a series of metrics that I've computed for different sample groups in my data, and I want to compare the distributions of a given metric with a boxplot for each sample group, using a dropdown list to choose the metric being compared. But when I do the following, I get a JavaScript Error:
When I change the mark type to
mark_tick()
, the plot renders correctly:Is this an issue with Altair, or with vega-lite?
Thanks for your help!
The text was updated successfully, but these errors were encountered: