Plotting¶
This page lists the plotting methods provided as part of nevis.
Alphabetical list:
- nevis.plot(boundaries=None, labels=None, trajectory=None, points=None, scale_bar=True, big_grid=False, small_grid=False, zoom=0.037037037037037035, headless=False, verbose=False)[source]¶
Creates a plot of the 2D elevation data in
heights.By default, this method uses
pyplotto create the figure, which can have the side-effect of instantiating a back-end for maptlotlib. Alternatively, the plot can be created in “headless” mode, by settingheadless=True.Arguments:
boundariesAn optional tuple
(xmin, xmax, ymin, ymax)defining the boundaries (in meters) of the plotted region.labelsAn optional dictionary mapping string labels to points (tuples in meters or Coords objects) that will be plotted on the map (if within the boundaries).
trajectoryAn optional array of shape
(n_points, 2)indicating the trajectory followed to get to Ben Nevis (points specified in meters).pointsAn optional array of shape
(n_points, 2)indicating points on the map (points specified in meters).scale_barSet to
Falseto disable the scale bar.big_gridShow the 2-letter grid squares (100km by 100km).
small_gridShow the 2-letter 2-number grid squares (10km by 10km)
zoomAdjust plot size by interpolating (
zoom > 1) or downsampling (zoom < 1).To downsample by e.g. a factor 10, set
zoom = 1 / 10. To interpolate and show e.g. 3x3 pixels per data point, setzoom = 3. Interpolation is performed using matplotlib’s “bilinear interpolation”.The default value is
1 / 27, which creates a reasonably sized plot for the full GB data set.headlessSet to
Trueto create the figure without using pyplot.verboseSet to
Trueto print updates tostdoutwhile plotting.
Returns a tuple
(fig, ax, heights, g)wherefigis the created figure,axis the axes the image is plotted on, andheightsis the (possibly downsampled) numpy array. The final entrygis a function that converts coordinates in meters to coordinates on the map axes.
- nevis.plot_line(f, point_1, point_2, label_1='Point 1', label_2='Point 2', padding=0.25, evaluations=400, figsize=(8, 5), headless=False, verbose=False)[source]¶
Draws a line between two points and evaluates a function along it.
Arguments:
fA function
f(x, y) -> z, or a sequence of multiple such functions.point_1The first point as a set of Coords or a numpy array in meters.
point_2The second point.
label_1,label_2Optional labels for the points.
paddingThe amount of padding shown to the left and right of the points, as a fraction of the total line length (e.g.
padding=0.25extends the line on either side by 25% of the distance between the two points).evaluationsThe number of evaluations of
fto plot.figsizeThe default figure size
headlessSet to
Trueto create the figure without using pyplot, i.e. to save withfigsaveinstead of callingplt.show().verboseSet to
Trueto print updates tostdoutwhile plotting.
Returns a tuple
(fig, ax, p1, p2)wherefigis the generated figure,axis the axes object within that figure, andp1andp2are the extremities of the line (points 1 and 2 plus padding) (as Coords).