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

Expose computed bounds after aggregation #1157

Closed
muendlein opened this issue Dec 30, 2022 · 2 comments · Fixed by #1198
Closed

Expose computed bounds after aggregation #1157

muendlein opened this issue Dec 30, 2022 · 2 comments · Fixed by #1198
Milestone

Comments

@muendlein
Copy link

Currently the data bounds will computed during aggregation if the x or y ranges are not provided explicitely:

canvas = ds.Canvas(plot_width=300, plot_height=300, x_axis_type='linear', y_axis_type='linear')
aggregation = canvas.points(df, 'x', 'y', agg=ds.count())

However those computed ranges do not seem to get exposed and are thus not really accessible. Nevertheless they are quite important when displaying the data. Thus I propose to utilize the attrs field of the xarray.DataArray (which can hold arbitrary metadata) to provide the (computed) ranges.
Essentially I want to get the following:

x_range = aggregation.attrs["x_range"]
y_range = aggregation.attrs["y_range"]
@ianthomas23 ianthomas23 added this to the v0.14.x milestone Jan 3, 2023
@ianthomas23
Copy link
Member

Thanks @muendlein, that is a good idea. I'd would be inclined to set the new range attributes regardless of whether they are computed or set by the user.

@muendlein
Copy link
Author

@ianthomas23 Agreed

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

Successfully merging a pull request may close this issue.

2 participants