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

Interactive sliders for transforms like LOESS #3306

Open
ProfEiz opened this issue Jan 2, 2024 · 1 comment
Open

Interactive sliders for transforms like LOESS #3306

ProfEiz opened this issue Jan 2, 2024 · 1 comment

Comments

@ProfEiz
Copy link

ProfEiz commented Jan 2, 2024

It seems that it is not possible to create a slider bar / interactive parameter for a transform, like LOESS.

`loess_slider = alt.binding_range(min=0, max=1, step= .02, name='bandwidth')
loess_var = alt.param(bind=loess_slider, value=.3)

chart = alt.Chart(df).mark_point().encode(
    x='horsepower',
    y='mpg',
    color = 'origin', 
).interactive(). add_params(
    loess_var
)

chart + chart.transform_loess('horsepower','mpg', bandwidth= loess_var).mark_line()`

Code above will not accept the bandwidth = slider-value parameter, though if I simply set the loess variable equal to a valid number, it works fine.

Separately, scipy.interpolation has a really nice cubic spline that is likely a better local smoother. But I assume that same problem will apply.

Expected use behavior would be to allow users to "tune" the LOESS interactively.

@joelostblom
Copy link
Contributor

I don't think transforms accepts parameters yet. The docs mention that you can only use a number https://altair-viz.github.io/user_guide/transform/loess.html. This would need to be implemented in Vega-Lite before it becomes available in altair..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants