I'm trying to find a way to extend regression lines in vega-lite/altair charts to the edge of the chart. As of now, when applying a regression transform to a dataset results in datapoints that only stretch to the bounding-box of the original dataset. Is it possible somehow to extend this range to the x/y extents of the chart? In the picture below, the black line is what vega-lite calculates per default. Extending the line to the edges as shown in yellow is what I'm trying to achieve.
EDIT
When specifying the extent
property on the transform_regression
call it seems like it is adjusting the y variable instead of the x variable. Maybe I'm grossly misunderstanding something but maybe it has something to do with the fact that my x variable are dates which might behave differently?
When I specify the extent like so
CDR_base.transform_regression(
'per_capita',
'year',
groupby=['region'],
extent=[2000, 2100]
).mark_line()
I would expect the extent of the regression lines to extend from 2000 to 2100. For some reason the extent gets applied to the y axis it seems.
You can use the
extent
argument of the regression transform to control the extent of the line. For example, here is a dataset with a default line:And here it is with
extent
set: