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

Datashade support for VectorField #5690

Open
brey opened this issue Apr 21, 2023 · 3 comments
Open

Datashade support for VectorField #5690

brey opened this issue Apr 21, 2023 · 3 comments

Comments

@brey
Copy link

brey commented Apr 21, 2023

Is your feature request related to a problem? Please describe.

In a case of very large datasets for e.g. wind data visualising quivers without datashade will be suboptimal. Is there a timeline or implementation path for this feature?

Describe the solution you'd like

Support Datashader as anticipated here

Describe alternatives you've considered

None

Additional context

None

@TheoMathurin
Copy link
Contributor

TheoMathurin commented Apr 21, 2023

Hi,

I also use HoloViews to visualise wind data.

It's likely that you don't need every single arrow shown on screen. If so, a workaround is to create a sparse vector field based on local average, dynamically adapting to the current viewport to keep a constant, user-determined number of vectors on screen.

Something along these lines:

            import datashader as ds

            def make_vector_field(x_range, y_range):
                cvs = ds.Canvas(plot_width=n_arrows_along_x,
                                plot_height=n_arrows_along_y,
                                x_range=x_range, y_range=y_range)
                angle = cvs.raster(data['angle'])
                magnitude = cvs.raster(data['magnitude'])
                vector_field = hv.VectorField((angle['longitude'], angle['latitude'], np.pi/2 - np.pi/180*angle[:, :], magnitude[:, :])).opts(magnitude='Magnitude')
                return vector_field


            xy_range = hv.streams.RangeXY()
            dmap = hv.DynamicMap(make_vector_field, streams=[xy_range])

Here is what my implementation looks like. It's on a remote server so there's some latency.

vectors

@brey
Copy link
Author

brey commented Apr 22, 2023

Thanks @TheoMathurin

Looks interesting.

However, my use case is 12M nodes in unstructured mesh, so subsetting becomes more complicated.

@jbednar
Copy link
Member

jbednar commented Apr 22, 2023

I may not be imagining the use case correctly, but I would think that people will have difficulting seeing the directions if a very large number of arrows are packed into a single plot without subsetting.

@TheoMathurin 's suggestion is precisely what I was coming here to suggest, i.e. using Datashader to render the unstructured mesh into a couple of structured meshs (representing the vector components), which will always have a fixed number of arrows to display and will thus be renderable in a readable form.

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

3 participants