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

adding a regression line causes vf to not cull unused data, also rendering looks pixelated #486

Open
jowens opened this issue Apr 28, 2024 · 3 comments

Comments

@jowens
Copy link

jowens commented Apr 28, 2024

I've been using vf to cull big dataframes of unecessary data when saving Altair plots to HTML. This works splendidly.

I am comparing two plots of the same data. One is just a scatter plot. The second is the same scatter plot with a regression line added on top of it.

Altair code looks like:

    lchart = alt.layer(chart, chart.transform_regression(df[x],df[y]).mark_line()

Anyway, I note:

  1. The original (non-regression-line) HTML is 342 kb but when adding the regression line, it's 1.2 MB. It now includes a lot of data values that don't have a valid y value. Consequently the range is now larger (because earlier dates on the x axis are now in the dataset even though they don't have y values).
  2. The plotted datapoints are now rasterized, which I wasn't expecting.

Screenshots of the rendered HTML below.

Don't know if either of these are from vf's influence. But neither was expected.

"Make a much much smaller example" is a perfectly cromulent response. :)

Processing_Power_over_Time_html Processing_Power_over_Time_html
@jonmmease
Copy link
Collaborator

Thanks for the report @jowens, glad to hear VegaFusion was been working well for you overall!

VegaFusion doesn't support Vega's regression transform yet. See #401 for some notes on that.

I don't quite follow what you mean by there being a difference in the points being rasterized. This should be controlled by the embed_options used when saving to html. See https://altair-viz.github.io/user_guide/saving_charts.html#html-format. Could you elaborate more?

@jowens
Copy link
Author

jowens commented Apr 28, 2024

OK, no regression transform support, got it. Good luck on further development!

In terms of "rasterized": The sharpness/quality of the points when I don't have the regression line:

https://owensgroup.github.io/gpustats/plots/Processing%20Power%20over%20Time.html

just looks way better than when I do:

https://owensgroup.github.io/gpustats/plots/Processing%20Power%20over%20Time_regressionline.html

but my guess is this has nothing to do with vf.

@jowens
Copy link
Author

jowens commented Apr 28, 2024

(Also it would be pretty cool if, when vf doesn't support a particular feature, it would print some sort of warning, even if that warning is behind a flag. Thanks for considering this.)

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

No branches or pull requests

2 participants