Vectorfield example

In [1]:
import numpy as np
import geoviews as gv
from cartopy.examples import arrows

gv.extension('matplotlib')
%output fig='svg' size=200

Define data

In [2]:
xs, ys, U, V, crs = arrows.sample_data()
mag = np.sqrt(U**2 + V**2)
angle = (np.pi/2.) - np.arctan2(U/mag, V/mag)
tiles = gv.tile_sources.Wikipedia
vectorfield = gv.VectorField((xs, ys, angle, mag), crs=crs)

Plot

In [3]:
%%opts VectorField [size_index='Magnitude'] WMTS [zoom=4]
tiles * vectorfield
Out[3]:

Download this notebook from GitHub (right-click to download).