sgsPy
structurally guided sampling
Loading...
Searching...
No Matches
sgspy.utils.plot

Functions

 plot_raster (raster, matplotlib.axes.Axes ax, int target_width=1000, int target_height=1000, Optional[int|str] band=None, **kwargs)
 plot_vector (vector, matplotlib.axes.Axes ax, str geomtype, Optional[int|str] layer=None, **kwargs)

Function Documentation

◆ plot_raster()

sgspy.utils.plot.plot_raster ( raster,
matplotlib.axes.Axes ax,
int target_width = 1000,
int target_height = 1000,
Optional[int | str] band = None,
** kwargs )
Plots the specified bands using matplotlib.pyplot.imshow function.

Parameters
--------------------
raster : SpatialRaster
    raster to plot
ax : matplotlib axis
    the axis to plot the image on
target_width : int
    maximum width in pixels for the image (after downsampling)
target_height : int
    maximum height in pxeils for the image (after downsampling)
band (optional) : int or str
    specification of which band to plot
**kwargs (optional)
    any parameters which may be passed to matplotlib.pyplot.imshow

◆ plot_vector()

sgspy.utils.plot.plot_vector ( vector,
matplotlib.axes.Axes ax,
str geomtype,
Optional[int | str] layer = None,
** kwargs )
Plots the specified layer using matplotlib.pyplot.plot.
The parameter give by geomtype must be one of:
'Point', 'MultiPoint', 'LineString', 'MultiLineString'.

The layer must contain only geometries of type Point and
MultiPoint in the case where 'Point' or 'MultiPoint is given,
or geometries of type LineString and MultiLineString 
in the case where 'LineString' or 'MultiLineString' is given.

Parameters
--------------------
vector : SpatialVector
    vector to plot
ax : matplotlib axis
    the axis to plot the image on
geomtype : str
    geometry type of the layer
layer : None | int | str
    layer to plot
**kwargs (optional)
    any parameter which may be passed to matplotlib.pyplot.plot

Raises
--------------------
ValueError:
    if no layer was specified, and the image contains more than one layer
ValueError:
    if geomtype is not one of 'Point', 'MultiPoint', 'LineString', 'MultiLineString'
RuntimeError (from C++):
    if the layer contains a geometry NOT of an acceptable type