geoviews package#
Subpackages#
- geoviews.data package
- Submodules
- Module contents
CubeInterface
CubeInterface.add_dimension()
CubeInterface.aggregate()
CubeInterface.applies()
CubeInterface.concat_dim()
CubeInterface.coords()
CubeInterface.groupby()
CubeInterface.irregular()
CubeInterface.length()
CubeInterface.loaded()
CubeInterface.range()
CubeInterface.redim()
CubeInterface.sample()
CubeInterface.select()
CubeInterface.select_to_constraint()
CubeInterface.sort()
CubeInterface.values()
GeoPandasInterface
GeomDictInterface
- geoviews.element package
- Submodules
- Module contents
- geoviews.models package
- geoviews.operation package
- geoviews.plotting package
Submodules#
Module contents#
- class geoviews.Contours(data=None, kdims=None, vdims=None, **kwargs)[source]#
Bases:
_Element
,Contours
Contours is a Path Element type that may contain any number of closed paths with an associated value and a coordinate reference system.
Methods
geom
([union, projection])Converts the Contours to a shapely geometry.
Parameter Definitions
Parameters inherited from:
holoviews.core.dimension.LabelledData
: labelholoviews.core.dimension.Dimensioned
: cdimsholoviews.core.element.Element2D
: extentsholoviews.element.path.Path
: datatypeholoviews.element.path.Contours
: vdimsgeoviews.element.geo._Element
: kdims, crsgroup = String(constant=True, default='Contours', label='Group')
A string describing the data wrapped by the object.
- geom(union=False, projection=None)[source]#
Converts the Contours to a shapely geometry.
- Parameters:
- unionbool, default=False
Whether to compute a union between the geometries
- projection
EPSG
python:str
|Cartopy
CRS
|python:None
Whether to project the geometry to other coordinate system
- Returns:
A
shapely
geometry
- class geoviews.Cycle(cycle=None, **params)[source]#
Bases:
Parameterized
A simple container class that specifies cyclic options. A typical example would be to cycle the curve colors in an Overlay composed of an arbitrary number of curves. The values may be supplied as an explicit list or a key to look up in the default cycles attribute.
Parameter Definitions
key = String(allow_None=True, default='default_colors', label='Key')
The key in the default_cycles dictionary used to specify the color cycle if values is not supplied.
values = List(bounds=(0, None), default=[], label='Values')
The values the cycle will iterate over.
- class geoviews.Dataset(data=None, kdims=None, vdims=None, **kwargs)[source]#
Bases:
_Element
,Dataset
Coordinate system aware version of a HoloViews dataset.
Parameter Definitions
Parameters inherited from:
holoviews.core.dimension.LabelledData
: labelholoviews.core.dimension.Dimensioned
: cdims, vdimsholoviews.core.data.Dataset
: datatypeholoviews.core.element.Element2D
: extentsgeoviews.element.geo._Element
: crsgroup = String(default='Dataset', label='Group')
A string describing the data wrapped by the object.
kdims = List(bounds=(0, None), constant=True, default=[Dimension('Longitude'), Dimension('Latitude')], label='Kdims')
The key dimensions defined as list of dimensions that may be used in indexing (and potential slicing) semantics. The order of the dimensions listed here determines the semantics of each component of a multi-dimensional indexing operation. Aliased with key_dimensions.
- class geoviews.Dimension(spec, **params)[source]#
Bases:
Parameterized
Dimension objects are used to specify some important general features that may be associated with a collection of values.
For instance, a Dimension may specify that a set of numeric values actually correspond to ‘Height’ (dimension name), in units of meters, with a descriptive label ‘Height of adult males’.
All dimensions object have a name that identifies them and a label containing a suitable description. If the label is not explicitly specified it matches the name.
These two parameters define the core identity of the dimension object and must match if two dimension objects are to be considered equivalent. All other parameters are considered optional metadata and are not used when testing for equality.
Unlike all the other parameters, these core parameters can be used to construct a Dimension object from a tuple. This format is sufficient to define an identical Dimension:
Dimension(‘a’, label=’Dimension A’) == Dimension((‘a’, ‘Dimension A’))
Everything else about a dimension is considered to reflect non-semantic preferences. Examples include the default value (which may be used in a visualization to set an initial slider position), how the value is to rendered as text (which may be used to specify the printed floating point precision) or a suitable range of values to consider for a particular analysis.
- Attributes:
pprint_label
The pretty-printed label string for the Dimension
spec
“Returns the Dimensions tuple specification
- type
Methods
clone
([spec])Clones the Dimension with new parameters
pprint_value
(value[, print_unit])Applies the applicable formatter to the value.
pprint_value_string
(value)Pretty print the dimension value and unit with title_format
pprint
Notes
Full unit support with automated conversions are on the HoloViews roadmap. Once rich unit objects are supported, the unit (or more specifically the type of unit) will be part of the core dimension specification used to establish equality.
Until this feature is implemented, there are two auxiliary parameters that hold some partial information about the unit: the name of the unit and whether or not it is cyclic. The name of the unit is used as part of the pretty-printed representation and knowing whether it is cyclic is important for certain operations.
Parameter Definitions
label = String(allow_None=True, label='Label')
Unrestricted label used to describe the dimension. A label should succinctly describe the dimension and may contain any characters, including Unicode and LaTeX expression.
cyclic = Boolean(default=False, label='Cyclic')
Whether the range of this feature is cyclic such that the maximum allowed value (defined by the range parameter) is continuous with the minimum allowed value.
default = Parameter(allow_None=True, label='Default')
Default value of the Dimension which may be useful for widget or other situations that require an initial or default value.
nodata = Integer(allow_None=True, inclusive_bounds=(True, True), label='Nodata')
Optional missing-data value for integer data. If non-None, data with this value will be replaced with NaN.
range = Tuple(default=(None, None), label='Range', length=2)
Specifies the minimum and maximum allowed values for a Dimension. None is used to represent an unlimited bound.
soft_range = Tuple(default=(None, None), label='Soft range', length=2)
Specifies a minimum and maximum reference value, which may be overridden by the data.
step = Number(allow_None=True, inclusive_bounds=(True, True), label='Step')
Optional floating point step specifying how frequently the underlying space should be sampled. May be used to define a discrete sampling over the range.
type = Parameter(allow_None=True, label='Type')
Optional type associated with the Dimension values. The type may be an inbuilt constructor (such as int, str, float) or a custom class object.
unit = String(allow_None=True, label='Unit')
Optional unit string associated with the Dimension. For instance, the string ‘m’ may be used represent units of meters and ‘s’ to represent units of seconds.
value_format = Callable(allow_None=True, label='Value format')
Formatting function applied to each value before display.
values = List(bounds=(0, None), default=[], label='Values')
Optional specification of the allowed value set for the dimension that may also be used to retain a categorical ordering.
- clone(spec=None, **overrides)[source]#
Clones the Dimension with new parameters
Derive a new Dimension that inherits existing parameters except for the supplied, explicit overrides
- Parameters:
- spec
python:tuple
,optional
Dimension tuple specification
- **overrides: Dimension parameter overrides
- spec
- Returns:
Cloned
Dimension
object
- property pprint_label#
The pretty-printed label string for the Dimension
- pprint_value(value, print_unit=False)[source]#
Applies the applicable formatter to the value.
- Parameters:
- value
Dimension value to format
- Returns:
Formatted
dimension
value
- class geoviews.DynamicMap(callback, initial_items=None, streams=None, **params)[source]#
Bases:
HoloMap
A DynamicMap is a type of HoloMap where the elements are dynamically generated by a callable. The callable is invoked with values associated with the key dimensions or with values supplied by stream parameters.
- Attributes:
current_key
Returns the current key value.
- opts
- redim
unbounded
Returns a list of key dimensions that are unbounded, excluding stream parameters.
Methods
add_dimension
(dimension, dim_pos, dim_val[, ...])Adds a dimension and its values to the object
clone
([data, shared_data, new_type, link])Clones the object, overriding data and parameters.
collate
()Unpacks DynamicMap into container of DynamicMaps
Packs DynamicMap of nested DynamicMaps into a single DynamicMap that returns a non-dynamic element
drop_dimension
(dimensions)Drops dimension(s) from keys
event
(**kwargs)Updates attached streams and triggers events
grid
([dimensions])Groups data by supplied dimension(s) laying the groups along the dimension(s) out in a GridSpace.
groupby
([dimensions, container_type, group_type])Groups DynamicMap by one or more dimensions
hist
([dimension, num_bins, bin_range, adjoin])Computes and adjoins histogram along specified dimension(s).
layout
([dimensions])Groups data by supplied dimension(s) laying the groups along the dimension(s) out in a NdLayout.
map
(map_fn[, specs, clone, link_inputs])Map a function to all objects matching the specs
options
(*args, **kwargs)Applies simplified option definition returning a new object.
overlay
([dimensions])Group by supplied dimension(s) and overlay each group
reindex
([kdims, force])Reorders key dimensions on DynamicMap
relabel
([label, group, depth])Clone object and apply new group and/or label.
reset
()Clear the DynamicMap cache
select
([selection_specs])Applies selection by dimension name
Parameter Definitions
Parameters inherited from:
kdims = List(bounds=(0, None), constant=True, default=[], label='Kdims')
The key dimensions of a DynamicMap map to the arguments of the callback. This mapping can be by position or by name.
callback = ClassSelector(allow_None=True, class_=<class 'holoviews.core.spaces.Callable'>, constant=True, label='Callback')
The callable used to generate the elements. The arguments to the callable includes any number of declared key dimensions as well as any number of stream parameters defined on the input streams. If the callable is an instance of Callable it will be used directly, otherwise it will be automatically wrapped in one.
streams = List(bounds=(0, None), constant=True, default=[], label='Streams')
List of Stream instances to associate with the DynamicMap. The set of parameter values across these streams will be supplied as keyword arguments to the callback when the events are received, updating the streams. Can also be supplied as a dictionary that maps parameters or panel widgets to callback argument names that will then be automatically converted to the equivalent list format.
cache_size = Integer(bounds=(1, None), default=500, inclusive_bounds=(True, True), label='Cache size')
The number of entries to cache for fast access. This is an LRU cache where the least recently used item is overwritten once the cache is full.
positional_stream_args = Boolean(constant=True, default=False, label='Positional stream args')
If False, stream parameters are passed to the callback as keyword arguments. If True, stream parameters are passed to callback as positional arguments. Each positional argument is a dict containing the contents of a stream. The positional stream arguments follow the positional arguments for each kdim, and they are ordered to match the order of the DynamicMap’s streams list.
- add_dimension(dimension, dim_pos, dim_val, vdim=False, **kwargs)[source]#
Adds a dimension and its values to the object
Requires the dimension name or object, the desired position in the key dimensions and a key value scalar or sequence of the same length as the existing keys.
- Parameters:
- dimension
Dimension or dimension spec to add
- dim_pos
python:int
Integer index to insert dimension at
- dim_valscalar or
ndarray
Dimension value(s) to add
- vdim
Disabled, this type does not have value dimensions
- **kwargs
Keyword arguments passed to the cloned element
- Returns:
Cloned
object
containing
the
new
dimension
- clone(data=None, shared_data=True, new_type=None, link=True, *args, **overrides)[source]#
Clones the object, overriding data and parameters.
- Parameters:
- data
New data replacing the existing data
- shared_databool,
optional
Whether to use existing data
- new_type
optional
Type to cast object to
- linkbool,
optional
Whether clone should be linked Determines whether Streams and Links attached to original object will be inherited.
- *args
Additional arguments to pass to constructor
- **overrides
New keyword arguments to pass to constructor
- Returns:
Cloned
object
- collate()[source]#
Unpacks DynamicMap into container of DynamicMaps
Collation allows unpacking DynamicMaps which return Layout, NdLayout or GridSpace objects into a single such object containing DynamicMaps. Assumes that the items in the layout or grid that is returned do not change.
- Returns:
Collated
container
containing
DynamicMaps
- property current_key#
Returns the current key value.
- decollate()[source]#
Packs DynamicMap of nested DynamicMaps into a single DynamicMap that returns a non-dynamic element
Decollation allows packing a DynamicMap of nested DynamicMaps into a single DynamicMap that returns a simple (non-dynamic) element. All nested streams are lifted to the resulting DynamicMap, and are available in the streams property. The callback property of the resulting DynamicMap is a pure, stateless function of the stream values. To avoid stream parameter name conflicts, the resulting DynamicMap is configured with positional_stream_args=True, and the callback function accepts stream values as positional dict arguments.
- Returns:
DynamicMap
that
returns
a
non-dynamicelement
- drop_dimension(dimensions)[source]#
Drops dimension(s) from keys
- Parameters:
- dimensions
Dimension(s) to drop
- Returns:
Clone
of
object
with
with
dropped
dimension
(s
)
- event(**kwargs)[source]#
Updates attached streams and triggers events
Automatically find streams matching the supplied kwargs to update and trigger events on them.
- Parameters:
- **kwargs
Events to update streams with
- grid(dimensions=None, **kwargs)[source]#
Groups data by supplied dimension(s) laying the groups along the dimension(s) out in a GridSpace.
- Parameters:
- dimensionsDimension/str or
python:list
Dimension or list of dimensions to group by
- dimensionsDimension/str or
- Returns:
- grid
GridSpace
GridSpace with supplied dimensions
- grid
- groupby(dimensions=None, container_type=None, group_type=None, **kwargs)[source]#
Groups DynamicMap by one or more dimensions
Applies groupby operation over the specified dimensions returning an object of type container_type (expected to be dictionary-like) containing the groups.
- Parameters:
- dimensions
Dimension
(s
)to
group
by
- container_type
Type
to
cast
group
container
to
- group_type
Type
to
cast
each
group
to
- dynamic
Whether
to
return
a
DynamicMap
- **kwargs: Keyword arguments to pass to each group
- dimensions
- Returns:
Returns
object
of
supplied
container_type
containing
the
- groups.
If
dynamic=Truereturns
a
DynamicMap
instead.
- hist(dimension=None, num_bins=20, bin_range=None, adjoin=True, **kwargs)[source]#
Computes and adjoins histogram along specified dimension(s).
Defaults to first value dimension if present otherwise falls back to first key dimension.
- Parameters:
- dimension
Dimension
(s
)to
compute
histogram
on
- num_bins
python:int
,optional
Number of bins
- bin_range
python:tuple
,optional
Lower and upper bounds of bins
- adjoinbool,
optional
Whether to adjoin histogram
- dimension
- Returns:
AdjointLayout
of
DynamicMap
and
adjoined
histogram
if
- adjoin=True,
otherwise
just
the
histogram
- layout(dimensions=None, **kwargs)[source]#
Groups data by supplied dimension(s) laying the groups along the dimension(s) out in a NdLayout.
- Parameters:
- dimensionsDimension/str or
python:list
Dimension or list of dimensions to group by
- dimensionsDimension/str or
- Returns:
- layout
NdLayout
NdLayout with supplied dimensions
- layout
- map(map_fn, specs=None, clone=True, link_inputs=True)[source]#
Map a function to all objects matching the specs
Recursively replaces elements using a map function when the specs apply, by default applies to all objects, e.g. to apply the function to all contained Curve objects:
dmap.map(fn, hv.Curve)
- Parameters:
- map_fn
Function
to
apply
to
each
object
- specs
List
of
specs
to
match
List of types, functions or type[.group][.label] specs to select objects to return, by default applies to all objects.
- clone
Whether
to
clone
the
object
ortransform
inplace
- map_fn
- Returns:
Returns
the
object
after
the
map_fn
has
been
applied
- options(*args, **kwargs)[source]#
Applies simplified option definition returning a new object.
Applies options defined in a flat format to the objects returned by the DynamicMap. If the options are to be set directly on the objects returned by the DynamicMap a simple format may be used, e.g.:
obj.options(cmap=’viridis’, show_title=False)
If the object is nested the options must be qualified using a type[.group][.label] specification, e.g.:
obj.options(‘Image’, cmap=’viridis’, show_title=False)
or using:
obj.options({‘Image’: dict(cmap=’viridis’, show_title=False)})
- Parameters:
- *args
Sets of options to apply to object Supports a number of formats including lists of Options objects, a type[.group][.label] followed by a set of keyword options to apply and a dictionary indexed by type[.group][.label] specs.
- backend
optional
Backend to apply options to Defaults to current selected backend
- clonebool,
optional
Whether to clone object Options can be applied inplace with clone=False
- **kwargs
Keywords of options Set of options to apply to the object
- Returns:
Returns
the
cloned
object
with
the
options
applied
- overlay(dimensions=None, **kwargs)[source]#
Group by supplied dimension(s) and overlay each group
Groups data by supplied dimension(s) overlaying the groups along the dimension(s).
- reindex(kdims=None, force=False)[source]#
Reorders key dimensions on DynamicMap
Create a new object with a reordered set of key dimensions. Dropping dimensions is not allowed on a DynamicMap.
- Parameters:
- kdims
List
of
dimensions
to
reindex
the
mapping
with
- force
Not
applicable
to
a
DynamicMap
- kdims
- Returns:
Reindexed
DynamicMap
- relabel(label=None, group=None, depth=1)[source]#
Clone object and apply new group and/or label.
Applies relabeling to children up to the supplied depth.
- Parameters:
- label
python:str
,optional
New label to apply to returned object
- group
python:str
,optional
New group to apply to returned object
- depth
python:int
,optional
Depth to which relabel will be applied If applied to container allows applying relabeling to contained objects up to the specified depth
- label
- Returns:
Returns
relabelled
object
- select(selection_specs=None, **kwargs)[source]#
Applies selection by dimension name
Applies a selection along the dimensions of the object using keyword arguments. The selection may be narrowed to certain objects using selection_specs. For container objects the selection will be applied to all children as well.
Selections may select a specific value, slice or set of values:
- value: Scalar values will select rows along with an exact
match, e.g.:
ds.select(x=3)
- slice: Slices may be declared as tuples of the upper and
lower bound, e.g.:
ds.select(x=(0, 3))
- values: A list of values may be selected using a list or
set, e.g.:
ds.select(x=[0, 1, 2])
- Parameters:
- selection_specs
List
of
specs
to
match
on
A list of types, functions, or type[.group][.label] strings specifying which objects to apply the selection on.
- **selection: Dictionary declaring selections by dimension
Selections can be scalar values, tuple ranges, lists of discrete values and boolean arrays
- selection_specs
- Returns:
Returns
an
Dimensioned
object
containing
the
selected
data
or
a
scalarif
a
single
value
was
selected
- property unbounded#
Returns a list of key dimensions that are unbounded, excluding stream parameters. If any of these key dimensions are unbounded, the DynamicMap as a whole is also unbounded.
- class geoviews.EdgePaths(data=None, kdims=None, vdims=None, **kwargs)[source]#
Bases:
Path
EdgePaths is a simple Element representing the paths of edges connecting nodes in a graph.
Parameter Definitions
Parameters inherited from:
holoviews.core.dimension.LabelledData
: labelholoviews.core.dimension.Dimensioned
: cdimsholoviews.core.element.Element2D
: extentsholoviews.element.geom.Geometry
: vdimsholoviews.element.path.Path
: datatypegeoviews.element.geo._Element
: kdims, crsgroup = String(constant=True, default='EdgePaths', label='Group')
A string describing the data wrapped by the object.
- class geoviews.Feature(data, kdims=None, vdims=None, **params)[source]#
Bases:
_GeoFeature
A Feature represents a geographical feature specified as a cartopy Feature type.
Methods
clone
([data, shared_data, new_type])Clones the object, overriding data and parameters.
geoms
([scale, bounds, as_element])Returns the geometries held by the Feature.
range
(dim[, data_range, dimension_range])Return the lower and upper bounds of values along dimension.
Parameter Definitions
Parameters inherited from:
holoviews.core.dimension.LabelledData
: labelholoviews.core.dimension.Dimensioned
: cdims, vdimsholoviews.core.element.Element2D
: extentsgeoviews.element.geo._Element
: kdims, crsgroup = String(default='Feature', label='Group')
A string describing the data wrapped by the object.
- clone(data=None, shared_data=True, new_type=None, *args, **overrides)[source]#
Clones the object, overriding data and parameters.
- Parameters:
- data
New data replacing the existing data
- shared_databool,
optional
Whether to use existing data
- new_type
optional
Type to cast object to
- linkbool,
optional
Whether clone should be linked Determines whether Streams and Links attached to original object will be inherited.
- *args
Additional arguments to pass to constructor
- **overrides
New keyword arguments to pass to constructor
- Returns:
Cloned
object
- geoms(scale=None, bounds=None, as_element=True)[source]#
Returns the geometries held by the Feature.
- Parameters:
- scale
python:str
Scale of the geometry to return expressed as string. Available scales depends on the Feature type.
- NaturalEarthFeature:
‘10m’, ‘50m’, ‘110m’
- GSHHSFeature:
‘auto’, ‘coarse’, ‘low’, ‘intermediate’, ‘high’, ‘full’
- bounds
python:tuple
Tuple of a bounding region to query for geometries in
- as_elementbool
Whether to wrap the geometries in an element
- scale
- Returns:
- geometriesPolygons/Path
Polygons or Path object wrapping around returned geometries
- range(dim, data_range=True, dimension_range=True)[source]#
Return the lower and upper bounds of values along dimension.
- Parameters:
- dimension
The dimension to compute the range on.
- data_rangebool
Compute range from data values
- dimension_rangebool
Include Dimension ranges Whether to include Dimension range and soft_range in range calculation
- Returns:
Tuple
containing
the
lower
and
upper
bound
- class geoviews.FilledContours(data=None, kdims=None, vdims=None, **kwargs)[source]#
Bases:
QuadMesh
Contours represents a 2D array of some quantity with some associated coordinates, which may be discretized into one or more filled contours.
Parameter Definitions
Parameters inherited from:
holoviews.core.dimension.LabelledData
: labelholoviews.core.dimension.Dimensioned
: cdimsholoviews.core.element.Element2D
: extentsgeoviews.element.geo._Element
: kdims, crsgeoviews.element.geo.QuadMesh
: vdims, datatypegroup = String(default='FilledContours', label='Group')
A string describing the data wrapped by the object.
- exception geoviews.GeoviewsDeprecationWarning[source]#
Bases:
DeprecationWarning
A Geoviews-specific
DeprecationWarning
subclass.Used to selectively filter Geoviews deprecations for unconditional display.
- exception geoviews.GeoviewsUserWarning[source]#
Bases:
UserWarning
A Geoviews-specific
UserWarning
subclass.Used to selectively filter Geoviews warnings for unconditional display.
- class geoviews.Graph(data=None, kdims=None, vdims=None, **kwargs)[source]#
Bases:
_Element
,Graph
- Attributes:
edgepaths
Returns the fixed EdgePaths or computes direct connections between supplied nodes.
Methods
Parameter Definitions
Parameters inherited from:
holoviews.core.dimension.LabelledData
: labelholoviews.core.dimension.Dimensioned
: cdims, vdimsholoviews.core.element.Element2D
: extentsholoviews.core.data.Dataset
: datatypegeoviews.element.geo._Element
: kdims, crsgroup = String(constant=True, default='Graph', label='Group')
A string describing the data wrapped by the object.
- property edgepaths#
Returns the fixed EdgePaths or computes direct connections between supplied nodes.
- class geoviews.GridSpace(initial_items=None, kdims=None, **params)[source]#
Bases:
Layoutable
,UniformNdMapping
Grids are distinct from Layouts as they ensure all contained elements to be of the same type. Unlike Layouts, which have integer keys, Grids usually have floating point keys, which correspond to a grid sampling in some two-dimensional space. This two-dimensional space may have to arbitrary dimensions, e.g. for 2D parameter spaces.
- Attributes:
Methods
Packs GridSpace of DynamicMaps into a single DynamicMap that returns a GridSpace
keys
([full_grid])Returns the keys of the GridSpace
Parameter Definitions
Parameters inherited from:
kdims = List(bounds=(1, 2), default=[Dimension('X'), Dimension('Y')], label='Kdims')
The key dimensions defined as list of dimensions that may be used in indexing (and potential slicing) semantics. The order of the dimensions listed here determines the semantics of each component of a multi-dimensional indexing operation. Aliased with key_dimensions.
- decollate()[source]#
Packs GridSpace of DynamicMaps into a single DynamicMap that returns a GridSpace
Decollation allows packing a GridSpace of DynamicMaps into a single DynamicMap that returns a GridSpace of simple (non-dynamic) elements. All nested streams are lifted to the resulting DynamicMap, and are available in the streams property. The callback property of the resulting DynamicMap is a pure, stateless function of the stream values. To avoid stream parameter name conflicts, the resulting DynamicMap is configured with positional_stream_args=True, and the callback function accepts stream values as positional dict arguments.
- Returns:
DynamicMap
that
returns
a
GridSpace
- keys(full_grid=False)[source]#
Returns the keys of the GridSpace
- Parameters:
- full_gridbool,
optional
Return full cross-product of keys
- full_gridbool,
- Returns:
List
of
keys
- property last#
The last of a GridSpace is another GridSpace constituted of the last of the individual elements. To access the elements by their X,Y position, either index the position directly or use the items() method.
- property shape#
Returns the 2D shape of the GridSpace as (rows, cols).
- class geoviews.HexTiles(data=None, kdims=None, vdims=None, **kwargs)[source]#
Bases:
_Element
,HexTiles
Points represent a collection of points with an associated cartopy coordinate-reference system.
Parameter Definitions
Parameters inherited from:
holoviews.core.dimension.LabelledData
: labelholoviews.core.dimension.Dimensioned
: cdims, vdimsholoviews.core.element.Element2D
: extentsholoviews.core.data.Dataset
: datatypegeoviews.element.geo._Element
: kdims, crsgroup = String(default='HexTiles', label='Group')
A string describing the data wrapped by the object.
- class geoviews.HoloMap(initial_items=None, kdims=None, group=None, label=None, **params)[source]#
Bases:
Layoutable
,UniformNdMapping
,Overlayable
A HoloMap is an n-dimensional mapping of viewable elements or overlays. Each item in a HoloMap has an tuple key defining the values along each of the declared key dimensions, defining the discretely sampled space of values.
The visual representation of a HoloMap consists of the viewable objects inside the HoloMap which can be explored by varying one or more widgets mapping onto the key dimensions of the HoloMap.
- Attributes:
- opts
Methods
collate
([merge_type, drop, drop_constant])Collate allows reordering nested containers
Packs HoloMap of DynamicMaps into a single DynamicMap that returns an HoloMap
grid
([dimensions])Group by supplied dimension(s) and lay out groups in grid
hist
([dimension, num_bins, bin_range, ...])Computes and adjoins histogram along specified dimension(s).
layout
([dimensions])Group by supplied dimension(s) and lay out groups
options
(*args, **kwargs)Applies simplified option definition returning a new object
overlay
([dimensions])Group by supplied dimension(s) and overlay each group
relabel
([label, group, depth])Clone object and apply new group and/or label.
Parameter Definitions
Parameters inherited from:
holoviews.core.dimension.LabelledData
: labelholoviews.core.dimension.Dimensioned
: cdimsholoviews.core.ndmapping.MultiDimensionalMapping
: kdims, vdims, sort- collate(merge_type=None, drop=None, drop_constant=False)[source]#
Collate allows reordering nested containers
Collation allows collapsing nested mapping types by merging their dimensions. In simple terms in merges nested containers into a single merged type.
In the simple case a HoloMap containing other HoloMaps can easily be joined in this way. However collation is particularly useful when the objects being joined are deeply nested, e.g. you want to join multiple Layouts recorded at different times, collation will return one Layout containing HoloMaps indexed by Time. Changing the merge_type will allow merging the outer Dimension into any other UniformNdMapping type.
- decollate()[source]#
Packs HoloMap of DynamicMaps into a single DynamicMap that returns an HoloMap
Decollation allows packing a HoloMap of DynamicMaps into a single DynamicMap that returns an HoloMap of simple (non-dynamic) elements. All nested streams are lifted to the resulting DynamicMap, and are available in the streams property. The callback property of the resulting DynamicMap is a pure, stateless function of the stream values. To avoid stream parameter name conflicts, the resulting DynamicMap is configured with positional_stream_args=True, and the callback function accepts stream values as positional dict arguments.
- Returns:
DynamicMap
that
returns
an
HoloMap
- grid(dimensions=None, **kwargs)[source]#
Group by supplied dimension(s) and lay out groups in grid
Groups data by supplied dimension(s) laying the groups along the dimension(s) out in a GridSpace.
- Parameters:
- dimensionsDimension/str or
python:list
Dimension or list of dimensions to group by
- dimensionsDimension/str or
- Returns:
GridSpace
with
supplied
dimensions
- hist(dimension=None, num_bins=20, bin_range=None, adjoin=True, individually=True, **kwargs)[source]#
Computes and adjoins histogram along specified dimension(s).
Defaults to first value dimension if present otherwise falls back to first key dimension.
- Parameters:
- dimension
Dimension(s) to compute histogram on
- num_bins
python:int
,optional
Number of bins
- bin_range
python:tuple
,optional
Lower and upper bounds of bins
- adjoinbool,
optional
Whether to adjoin histogram
- Returns:
AdjointLayout
of
HoloMap
and
histograms
orjust
the
histograms
- layout(dimensions=None, **kwargs)[source]#
Group by supplied dimension(s) and lay out groups
Groups data by supplied dimension(s) laying the groups along the dimension(s) out in a NdLayout.
- Parameters:
- dimensions
Dimension(s) to group by
- Returns:
NdLayout
with
supplied
dimensions
- options(*args, **kwargs)[source]#
Applies simplified option definition returning a new object
Applies options defined in a flat format to the objects returned by the DynamicMap. If the options are to be set directly on the objects in the HoloMap a simple format may be used, e.g.:
obj.options(cmap=’viridis’, show_title=False)
If the object is nested the options must be qualified using a type[.group][.label] specification, e.g.:
obj.options(‘Image’, cmap=’viridis’, show_title=False)
or using:
obj.options({‘Image’: dict(cmap=’viridis’, show_title=False)})
- Parameters:
- *args
Sets of options to apply to object Supports a number of formats including lists of Options objects, a type[.group][.label] followed by a set of keyword options to apply and a dictionary indexed by type[.group][.label] specs.
- backend
optional
Backend to apply options to Defaults to current selected backend
- clonebool,
optional
Whether to clone object Options can be applied inplace with clone=False
- **kwargs: Keywords of options
Set of options to apply to the object
- Returns:
Returns
the
cloned
object
with
the
options
applied
- overlay(dimensions=None, **kwargs)[source]#
Group by supplied dimension(s) and overlay each group
Groups data by supplied dimension(s) overlaying the groups along the dimension(s).
- Parameters:
- dimensions
Dimension(s) of dimensions to group by
- Returns:
NdOverlay
object
(s
)with
supplied
dimensions
- relabel(label=None, group=None, depth=1)[source]#
Clone object and apply new group and/or label.
Applies relabeling to children up to the supplied depth.
- Parameters:
- label
python:str
,optional
New label to apply to returned object
- group
python:str
,optional
New group to apply to returned object
- depth
python:int
,optional
Depth to which relabel will be applied If applied to container allows applying relabeling to contained objects up to the specified depth
- label
- Returns:
Returns
relabelled
object
- class geoviews.Image(data=None, kdims=None, vdims=None, **kwargs)[source]#
Bases:
_Element
,Image
Image represents a 2D array of some quantity with some associated coordinates.
Methods
from_xarray
Parameter Definitions
Parameters inherited from:
holoviews.core.dimension.LabelledData
: labelholoviews.core.dimension.Dimensioned
: cdimsholoviews.core.element.Element2D
: extentsholoviews.element.raster.Image
: datatype, bounds, rtolgeoviews.element.geo._Element
: kdims, crsgroup = String(default='Image', label='Group')
A string describing the data wrapped by the object.
vdims = List(bounds=(1, None), default=[Dimension('z')], label='Vdims')
The dimension description of the data held in the matrix.
- class geoviews.ImageStack(data=None, kdims=None, vdims=None, **kwargs)[source]#
Bases:
_Element
,ImageStack
ImageStack expands the capabilities of Image to by supporting multiple layers of images.
As there is many ways to represent multiple layers of images, the following options are supported:
A 3D Numpy array with the shape (y, x, level)
A list of 2D Numpy arrays with identical shape (y, x)
- A dictionary where the keys will be set as the vdims and the
values are 2D Numpy arrays with identical shapes (y, x). If the dictionary’s keys matches the kdims of the element, they need to be 1D arrays.
- A tuple containing (x, y, level_0, level_1, …),
where the level is a 2D Numpy array in the shape of (y, x).
An xarray DataArray or Dataset where its coords contain the kdims.
If no kdims are supplied, x and y are used.
If no vdims are supplied, and the naming can be inferred like with a dictionary the levels will be named level_0, level_1, etc.
Parameter Definitions
Parameters inherited from:
holoviews.core.dimension.LabelledData
: labelholoviews.core.dimension.Dimensioned
: cdimsholoviews.core.element.Element2D
: extentsholoviews.element.raster.Image
: datatype, bounds, rtolgeoviews.element.geo._Element
: kdims, crsgroup = String(constant=True, default='ImageStack', label='Group')
A string describing the data wrapped by the object.
vdims = List(bounds=(1, None), default=[Dimension('z')], label='Vdims')
The dimension description of the data held in the matrix.
- class geoviews.Labels(data=None, kdims=None, vdims=None, **kwargs)[source]#
Bases:
_Element
,Labels
Points represent a collection of points with an associated cartopy coordinate-reference system.
Parameter Definitions
Parameters inherited from:
holoviews.core.dimension.LabelledData
: labelholoviews.core.dimension.Dimensioned
: cdimsholoviews.core.element.Element2D
: extentsholoviews.core.data.Dataset
: datatypeholoviews.element.annotation.Labels
: vdimsgeoviews.element.geo._Element
: kdims, crsgroup = String(default='Labels', label='Group')
A string describing the data wrapped by the object.
- class geoviews.Layout(items=None, identifier=None, parent=None, **kwargs)[source]#
Bases:
Layoutable
,ViewableTree
A Layout is an ViewableTree with ViewableElement objects as leaf values.
Unlike ViewableTree, a Layout supports a rich display, displaying leaf items in a grid style layout. In addition to the usual ViewableTree indexing, Layout supports indexing of items by their row and column index in the layout.
The maximum number of columns in such a layout may be controlled with the cols method.
- Attributes:
shape
Tuple indicating the number of rows and columns in the Layout.
Methods
clone
(*args, **overrides)Clones the Layout, overriding data and parameters.
cols
(ncols)Sets the maximum number of columns in the NdLayout.
Packs Layout of DynamicMaps into a single DynamicMap that returns a Layout
relabel
([label, group, depth])Clone object and apply new group and/or label.
grid_items
Parameter Definitions
Parameters inherited from:
holoviews.core.dimension.LabelledData
: labelholoviews.core.dimension.Dimensioned
: cdims, kdims, vdimsgroup = String(constant=True, default='Layout', label='Group')
A string describing the data wrapped by the object.
- clone(*args, **overrides)[source]#
Clones the Layout, overriding data and parameters.
- Parameters:
- data
New data replacing the existing data
- shared_databool,
optional
Whether to use existing data
- new_type
optional
Type to cast object to
- *args
Additional arguments to pass to constructor
- **overrides
New keyword arguments to pass to constructor
- Returns:
Cloned
Layout
object
- cols(ncols)[source]#
Sets the maximum number of columns in the NdLayout.
Any items beyond the set number of cols will flow onto a new row. The number of columns control the indexing and display semantics of the NdLayout.
- Parameters:
- ncols
python:int
Number of columns to set on the NdLayout
- ncols
- decollate()[source]#
Packs Layout of DynamicMaps into a single DynamicMap that returns a Layout
Decollation allows packing a Layout of DynamicMaps into a single DynamicMap that returns a Layout of simple (non-dynamic) elements. All nested streams are lifted to the resulting DynamicMap, and are available in the streams property. The callback property of the resulting DynamicMap is a pure, stateless function of the stream values. To avoid stream parameter name conflicts, the resulting DynamicMap is configured with positional_stream_args=True, and the callback function accepts stream values as positional dict arguments.
- Returns:
DynamicMap
that
returns
a
Layout
- relabel(label=None, group=None, depth=1)[source]#
Clone object and apply new group and/or label.
Applies relabeling to children up to the supplied depth.
- Parameters:
- label
python:str
,optional
New label to apply to returned object
- group
python:str
,optional
New group to apply to returned object
- depth
python:int
,optional
Depth to which relabel will be applied If applied to container allows applying relabeling to contained objects up to the specified depth
- label
- Returns:
Returns
relabelled
object
- property shape#
Tuple indicating the number of rows and columns in the Layout.
- class geoviews.LineContours(data=None, kdims=None, vdims=None, **kwargs)[source]#
Bases:
QuadMesh
LineContours represents a 2D array of some quantity with some associated coordinates, which may be discretized into one or more line contours.
Parameter Definitions
Parameters inherited from:
holoviews.core.dimension.LabelledData
: labelholoviews.core.dimension.Dimensioned
: cdimsholoviews.core.element.Element2D
: extentsgeoviews.element.geo._Element
: kdims, crsgeoviews.element.geo.QuadMesh
: vdims, datatypegroup = String(default='LineContours', label='Group')
A string describing the data wrapped by the object.
- class geoviews.NdLayout(initial_items=None, kdims=None, **params)[source]#
Bases:
Layoutable
,UniformNdMapping
NdLayout is a UniformNdMapping providing an n-dimensional data structure to display the contained Elements and containers in a layout. Using the cols method the NdLayout can be rearranged with the desired number of columns.
- Attributes:
Methods
clone
(*args, **overrides)Clones the NdLayout, overriding data and parameters.
cols
(ncols)Sets the maximum number of columns in the NdLayout.
Compute a dict of {(row,column): (key, value)} elements from the current set of items and specified number of columns.
Parameter Definitions
Parameters inherited from:
holoviews.core.dimension.LabelledData
: labelholoviews.core.dimension.Dimensioned
: cdimsholoviews.core.ndmapping.MultiDimensionalMapping
: kdims, vdims, sort- clone(*args, **overrides)[source]#
Clones the NdLayout, overriding data and parameters.
- Parameters:
- data
New data replacing the existing data
- shared_databool,
optional
Whether to use existing data
- new_type
optional
Type to cast object to
- *args
Additional arguments to pass to constructor
- **overrides
New keyword arguments to pass to constructor
- Returns:
Cloned
NdLayout
object
- cols(ncols)[source]#
Sets the maximum number of columns in the NdLayout.
Any items beyond the set number of cols will flow onto a new row. The number of columns control the indexing and display semantics of the NdLayout.
- Parameters:
- ncols
python:int
Number of columns to set on the NdLayout
- ncols
- grid_items()[source]#
Compute a dict of {(row,column): (key, value)} elements from the current set of items and specified number of columns.
- property last#
Returns another NdLayout constituted of the last views of the individual elements (if they are maps).
- property shape#
Tuple indicating the number of rows and columns in the NdLayout.
- class geoviews.NdOverlay(overlays=None, kdims=None, **params)[source]#
Bases:
Overlayable
,UniformNdMapping
,CompositeOverlay
An NdOverlay allows a group of NdOverlay to be overlaid together. NdOverlay can be indexed out of an overlay and an overlay is an iterable that iterates over the contained layers.
Methods
Packs NdOverlay of DynamicMaps into a single DynamicMap that returns an NdOverlay
Parameter Definitions
Parameters inherited from:
kdims = List(bounds=(0, None), constant=True, default=[Dimension('Element')], label='Kdims')
List of dimensions the NdOverlay can be indexed by.
- decollate()[source]#
Packs NdOverlay of DynamicMaps into a single DynamicMap that returns an NdOverlay
Decollation allows packing a NdOverlay of DynamicMaps into a single DynamicMap that returns an NdOverlay of simple (non-dynamic) elements. All nested streams are lifted to the resulting DynamicMap, and are available in the streams property. The callback property of the resulting DynamicMap is a pure, stateless function of the stream values. To avoid stream parameter name conflicts, the resulting DynamicMap is configured with positional_stream_args=True, and the callback function accepts stream values as positional dict arguments.
- Returns:
DynamicMap
that
returns
an
NdOverlay
- class geoviews.Nodes(data=None, kdims=None, vdims=None, **kwargs)[source]#
Bases:
_Element
,Nodes
Nodes is a simple Element representing Graph nodes as a set of Points. Unlike regular Points, Nodes must define a third key dimension corresponding to the node index.
Parameter Definitions
Parameters inherited from:
holoviews.core.dimension.LabelledData
: labelholoviews.core.dimension.Dimensioned
: cdimsholoviews.core.element.Element2D
: extentsholoviews.core.data.Dataset
: datatypeholoviews.element.geom.Geometry
: vdimsgeoviews.element.geo._Element
: crsgroup = String(constant=True, default='Nodes', label='Group')
A string describing the data wrapped by the object.
kdims = List(bounds=(3, 3), default=[Dimension('Longitude'), Dimension('Latitude'), Dimension('index')], label='Kdims')
The key dimensions defined as list of dimensions that may be used in indexing (and potential slicing) semantics. The order of the dimensions listed here determines the semantics of each component of a multi-dimensional indexing operation. Aliased with key_dimensions.
- class geoviews.Overlay(items=None, group=None, label=None, **params)[source]#
Bases:
ViewableTree
,CompositeOverlay
,Layoutable
,Overlayable
An Overlay consists of multiple Elements (potentially of heterogeneous type) presented one on top each other with a particular z-ordering.
Overlays along with elements constitute the only valid leaf types of a Layout and in fact extend the Layout structure. Overlays are constructed using the * operator (building an identical structure to the + operator).
- Attributes:
ddims
The list of deep dimensions
- shape
Methods
clone
([data, shared_data, new_type, link])Clones the object, overriding data and parameters.
collate
()Collates any objects in the Overlay resolving any issues the recommended nesting structure.
Packs Overlay of DynamicMaps into a single DynamicMap that returns an Overlay
get
(identifier[, default])Get a layer in the Overlay.
Parameter Definitions
Parameters inherited from:
holoviews.core.dimension.LabelledData
: labelholoviews.core.dimension.Dimensioned
: cdims, kdims, vdims- clone(data=None, shared_data=True, new_type=None, link=True, **overrides)[source]#
Clones the object, overriding data and parameters.
- Parameters:
- data
New data replacing the existing data
- shared_databool,
optional
Whether to use existing data
- new_type
optional
Type to cast object to
- linkbool,
optional
Whether clone should be linked Determines whether Streams and Links attached to original object will be inherited.
- *args
Additional arguments to pass to constructor
- **overrides
New keyword arguments to pass to constructor
- Returns:
Cloned
object
- collate()[source]#
Collates any objects in the Overlay resolving any issues the recommended nesting structure.
- property ddims#
The list of deep dimensions
- decollate()[source]#
Packs Overlay of DynamicMaps into a single DynamicMap that returns an Overlay
Decollation allows packing an Overlay of DynamicMaps into a single DynamicMap that returns an Overlay of simple (non-dynamic) elements. All nested streams are lifted to the resulting DynamicMap, and are available in the streams property. The callback property of the resulting DynamicMap is a pure, stateless function of the stream values. To avoid stream parameter name conflicts, the resulting DynamicMap is configured with positional_stream_args=True, and the callback function accepts stream values as positional dict arguments.
- Returns:
DynamicMap
that
returns
an
Overlay
- get(identifier, default=None)[source]#
Get a layer in the Overlay.
Get a particular layer in the Overlay using its path string or an integer index.
- Parameters:
- identifier
Index or path string of the item to return
- default
Value to return if no item is found
- Returns:
The
indexed
layer
of
the
Overlay
- property group#
str(object=’’) -> str str(bytes_or_buffer[, encoding[, errors]]) -> str
Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.__str__() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to ‘strict’.
- property label#
str(object=’’) -> str str(bytes_or_buffer[, encoding[, errors]]) -> str
Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.__str__() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to ‘strict’.
- class geoviews.Palette(key, **params)[source]#
Bases:
Cycle
Palettes allow easy specifying a discrete sampling of an existing colormap. Palettes may be supplied a key to look up a function function in the colormap class attribute. The function should accept a float scalar in the specified range and return a RGB(A) tuple. The number of samples may also be specified as a parameter.
The range and samples may conveniently be overridden with the __getitem__ method.
Parameter Definitions
Parameters inherited from:
holoviews.core.options.Cycle
: valueskey = String(default='grayscale', label='Key')
Palettes look up the Palette values based on some key.
range = NumericTuple(default=(0, 1), label='Range', length=2)
The range from which the Palette values are sampled.
samples = Integer(default=32, inclusive_bounds=(True, True), label='Samples')
The number of samples in the given range to supply to the sample_fn.
sample_fn = Callable(default=<function linspace at 0x10e67e670>, label='Sample fn')
The function to generate the samples, by default linear.
reverse = Boolean(default=False, label='Reverse')
Whether to reverse the palette.
- sample_fn(stop, num=50, endpoint=True, retstep=False, dtype=None, axis=0, *, device=None)[source]#
Return evenly spaced numbers over a specified interval.
Returns num evenly spaced samples, calculated over the interval [start, stop].
The endpoint of the interval can optionally be excluded.
Changed in version 1.20.0: Values are rounded towards
-inf
instead of0
when an integerdtype
is specified. The old behavior can still be obtained withnp.linspace(start, stop, num).astype(int)
- Parameters:
- startnumpy:array_like
The starting value of the sequence.
- stopnumpy:array_like
The end value of the sequence, unless endpoint is set to False. In that case, the sequence consists of all but the last of
num + 1
evenly spaced samples, so that stop is excluded. Note that the step size changes when endpoint is False.- num
python:int
,optional
Number of samples to generate. Default is 50. Must be non-negative.
- endpointbool,
optional
If True, stop is the last sample. Otherwise, it is not included. Default is True.
- retstepbool,
optional
If True, return (samples, step), where step is the spacing between samples.
- dtype
dtype
,optional
The type of the output array. If dtype is not given, the data type is inferred from start and stop. The inferred dtype will never be an integer; float is chosen even if the arguments would produce an array of integers.
- axis
python:int
,optional
The axis in the result to store the samples. Relevant only if start or stop are array-like. By default (0), the samples will be along a new axis inserted at the beginning. Use -1 to get an axis at the end.
- device
python:str
,optional
The device on which to place the created array. Default: None. For Array-API interoperability only, so must be
"cpu"
if passed.Added in version 2.0.0.
- Returns:
- samples
ndarray
There are num equally spaced samples in the closed interval
[start, stop]
or the half-open interval[start, stop)
(depending on whether endpoint is True or False).- step
python:float
,optional
Only returned if retstep is True
Size of spacing between samples.
- samples
See also
arange
Similar to linspace, but uses a step size (instead of the number of samples).
geomspace
Similar to linspace, but with numbers spaced evenly on a log scale (a geometric progression).
logspace
Similar to geomspace, but with the end points specified as logarithms.
- how-to-partition
Examples
>>> import numpy as np >>> np.linspace(2.0, 3.0, num=5) array([2. , 2.25, 2.5 , 2.75, 3. ]) >>> np.linspace(2.0, 3.0, num=5, endpoint=False) array([2. , 2.2, 2.4, 2.6, 2.8]) >>> np.linspace(2.0, 3.0, num=5, retstep=True) (array([2. , 2.25, 2.5 , 2.75, 3. ]), 0.25)
Graphical illustration:
>>> import matplotlib.pyplot as plt >>> N = 8 >>> y = np.zeros(N) >>> x1 = np.linspace(0, 10, N, endpoint=True) >>> x2 = np.linspace(0, 10, N, endpoint=False) >>> plt.plot(x1, y, 'o') [<matplotlib.lines.Line2D object at 0x...>] >>> plt.plot(x2, y + 0.5, 'o') [<matplotlib.lines.Line2D object at 0x...>] >>> plt.ylim([-0.5, 1]) (-0.5, 1) >>> plt.show()
- class geoviews.Path(data=None, kdims=None, vdims=None, **kwargs)[source]#
Bases:
_Element
,Path
The Path Element contains a list of Paths stored as Nx2 numpy arrays along with a coordinate reference system.
Methods
geom
([union, projection])Converts the Path to a shapely geometry.
Parameter Definitions
Parameters inherited from:
holoviews.core.dimension.LabelledData
: labelholoviews.core.dimension.Dimensioned
: cdimsholoviews.core.element.Element2D
: extentsholoviews.element.geom.Geometry
: vdimsholoviews.element.path.Path
: datatypegeoviews.element.geo._Element
: kdims, crsgroup = String(constant=True, default='Path', label='Group')
A string describing the data wrapped by the object.
- geom(union=False, projection=None)[source]#
Converts the Path to a shapely geometry.
- Parameters:
- unionbool, default=False
Whether to compute a union between the geometries
- projection
EPSG
python:str
|Cartopy
CRS
|python:None
Whether to project the geometry to other coordinate system
- Returns:
A
shapely
geometry
- class geoviews.Points(data=None, kdims=None, vdims=None, **kwargs)[source]#
Bases:
_Element
,Points
Points represent a collection of points with an associated cartopy coordinate-reference system.
Methods
geom
([union, projection])Converts the Points to a shapely geometry.
Parameter Definitions
Parameters inherited from:
holoviews.core.dimension.LabelledData
: labelholoviews.core.dimension.Dimensioned
: cdimsholoviews.core.element.Element2D
: extentsholoviews.core.data.Dataset
: datatypeholoviews.element.geom.Geometry
: vdimsgeoviews.element.geo._Element
: kdims, crsgroup = String(default='Points', label='Group')
A string describing the data wrapped by the object.
- geom(union=False, projection=None)[source]#
Converts the Points to a shapely geometry.
- Parameters:
- unionbool, default=False
Whether to compute a union between the geometries
- projection
EPSG
python:str
|Cartopy
CRS
|python:None
Whether to project the geometry to other coordinate system
- Returns:
A
shapely
geometry
- class geoviews.Polygons(data=None, kdims=None, vdims=None, **kwargs)[source]#
Bases:
_Element
,Polygons
Polygons is a Path Element type that may contain any number of closed paths with an associated value and a coordinate reference system.
Methods
geom
([union, projection])Converts the Path to a shapely geometry.
Parameter Definitions
Parameters inherited from:
holoviews.core.dimension.LabelledData
: labelholoviews.core.dimension.Dimensioned
: cdimsholoviews.core.element.Element2D
: extentsholoviews.element.path.Path
: datatypeholoviews.element.path.Polygons
: vdimsgeoviews.element.geo._Element
: kdims, crsgroup = String(constant=True, default='Polygons', label='Group')
A string describing the data wrapped by the object.
- geom(union=False, projection=None)[source]#
Converts the Path to a shapely geometry.
- Parameters:
- unionbool, default=False
Whether to compute a union between the geometries
- projection
EPSG
python:str
|Cartopy
CRS
|python:None
Whether to project the geometry to other coordinate system
- Returns:
A
shapely
geometry
- class geoviews.QuadMesh(data=None, kdims=None, vdims=None, **kwargs)[source]#
Bases:
_Element
,QuadMesh
QuadMesh is a Raster type to hold x- and y- bin values with associated values. The x- and y-values of the QuadMesh may be supplied either as the edges of each bin allowing uneven sampling or as the bin centers, which will be converted to evenly sampled edges.
As a secondary but less supported mode QuadMesh can contain a mesh of quadrilateral coordinates that is not laid out in a grid. The data should then be supplied as three separate 2D arrays for the x-/y-coordinates and grid values.
Methods
trimesh
()Converts a QuadMesh into a TriMesh.
from_xarray
Parameter Definitions
Parameters inherited from:
holoviews.core.dimension.LabelledData
: labelholoviews.core.dimension.Dimensioned
: cdimsholoviews.core.element.Element2D
: extentsgeoviews.element.geo._Element
: kdims, crsgroup = String(default='QuadMesh', label='Group')
A string describing the data wrapped by the object.
vdims = List(bounds=(1, None), default=[Dimension('z')], label='Vdims')
The value dimensions defined as the list of dimensions used to describe the components of the data. If multiple value dimensions are supplied, a particular value dimension may be indexed by name after the key dimensions. Aliased with value_dimensions.
datatype = List(bounds=(0, None), default=['grid', 'xarray'], label='Datatype')
A priority list of the data types to be used for storage on the .data attribute. If the input supplied to the element constructor cannot be put into the requested format, the next format listed will be used until a suitable format is found (or the data fails to be understood).
- class geoviews.RGB(data=None, kdims=None, vdims=None, **kwargs)[source]#
Bases:
_Element
,RGB
An RGB element is a Image containing channel data for the the red, green, blue and (optionally) the alpha channels. The values of each channel must be in the range 0.0 to 1.0.
In input array may have a shape of NxMx4 or NxMx3. In the latter case, the defined alpha dimension parameter is appended to the list of value dimensions.
Methods
from_xarray
(da[, crs, apply_transform, ...])Returns an RGB or Image element given an xarray DataArray loaded using xr.open_rasterio.
Parameter Definitions
Parameters inherited from:
holoviews.core.dimension.LabelledData
: labelholoviews.core.dimension.Dimensioned
: cdimsholoviews.core.element.Element2D
: extentsholoviews.element.raster.Image
: datatype, bounds, rtolholoviews.element.raster.RGB
: alpha_dimensiongeoviews.element.geo._Element
: kdims, crsgroup = String(constant=True, default='RGB', label='Group')
A string describing the data wrapped by the object.
vdims = List(bounds=(3, 4), default=[Dimension('R'), Dimension('G'), Dimension('B')], label='Vdims')
The dimension description of the data held in the matrix. If an alpha channel is supplied, the defined alpha_dimension is automatically appended to this list.
- classmethod from_xarray(da, crs=None, apply_transform=False, nan_nodata=False, **kwargs)[source]#
Returns an RGB or Image element given an xarray DataArray loaded using xr.open_rasterio.
If a crs attribute is present on the loaded data it will attempt to decode it into a cartopy projection otherwise it will default to a non-geographic HoloViews element.
- Parameters:
- da
xarray.DataArray
DataArray to convert to element
- crs
Cartopy
CRS
orEPSG
python:str
(optional
) Overrides CRS inferred from the data
- apply_transformbool
Whether to apply affine transform if defined on the data
- nan_nodatabool
If data contains nodata values convert them to NaNs
- **kwargs
Keyword arguments passed to the HoloViews/GeoViews element
- da
- Returns:
element
Image/RGB/QuadMesh element
- class geoviews.Rectangles(data=None, kdims=None, vdims=None, **kwargs)[source]#
Bases:
_Element
,Rectangles
Rectangles represent a collection of axis-aligned rectangles in 2D space.
Methods
geom
([union, projection])Converts the Rectangles to a shapely geometry.
Parameter Definitions
Parameters inherited from:
holoviews.core.dimension.LabelledData
: labelholoviews.core.dimension.Dimensioned
: cdimsholoviews.core.element.Element2D
: extentsholoviews.core.data.Dataset
: datatypeholoviews.element.geom.Geometry
: vdimsgeoviews.element.geo._Element
: crsgroup = String(constant=True, default='Rectangles', label='Group')
A string describing the data wrapped by the object.
kdims = List(bounds=(4, 4), constant=True, default=[Dimension('lon0'), Dimension('lat0'), Dimension('lon1'), Dimension('lat1')], label='Kdims')
The key dimensions of the Rectangles element represent the bottom-left (lon0, lat0) and top right (lon1, lat1) coordinates of each box.
- geom(union=False, projection=None)[source]#
Converts the Rectangles to a shapely geometry.
- Parameters:
- unionbool, default=False
Whether to compute a union between the geometries
- projection
EPSG
python:str
|Cartopy
CRS
|python:None
Whether to project the geometry to other coordinate system
- Returns:
A
shapely
geometry
- class geoviews.Segments(data=None, kdims=None, vdims=None, **kwargs)[source]#
Bases:
_Element
,Segments
Segments represent a collection of lines in 2D space.
Methods
geom
([union, projection])Converts the Segments to a shapely geometry.
Parameter Definitions
Parameters inherited from:
holoviews.core.dimension.LabelledData
: labelholoviews.core.dimension.Dimensioned
: cdimsholoviews.core.element.Element2D
: extentsholoviews.core.data.Dataset
: datatypeholoviews.element.geom.Geometry
: vdimsgeoviews.element.geo._Element
: crsgroup = String(constant=True, default='Segments', label='Group')
A string describing the data wrapped by the object.
kdims = List(bounds=(4, 4), constant=True, default=[Dimension('lon0'), Dimension('lat0'), Dimension('lon1'), Dimension('lat1')], label='Kdims')
The key dimensions of the Segments element represent the bottom-left (lon0, lat0) and top-right (lon1, lat1) coordinates of each segment.
- class geoviews.Shape(data=None, kdims=None, vdims=None, **kwargs)[source]#
Bases:
Dataset
Shape wraps any shapely geometry type.
Methods
from_records
(records[, dataset, on, value, ...])Load data from a collection of cartopy.io.shapereader.Record objects and optionally merge it with a dataset to assign values to each polygon and form a chloropleth.
from_shapefile
(shapefile, *args, **kwargs)Loads a shapefile from disk and optionally merges it with a dataset.
geom
([union, projection])Returns the Shape as a shapely geometry
Parameter Definitions
Parameters inherited from:
holoviews.core.dimension.LabelledData
: labelholoviews.core.dimension.Dimensioned
: cdimsholoviews.core.element.Element2D
: extentsgeoviews.element.geo._Element
: crsgeoviews.element.geo.Dataset
: kdimsgroup = String(default='Shape', label='Group')
A string describing the data wrapped by the object.
vdims = List(bounds=(0, None), default=[], label='Vdims')
Shape optionally accept a value dimension, corresponding to the supplied values.
datatype = List(bounds=(0, None), default=['geom_dictionary'], label='Datatype')
A priority list of the data types to be used for storage on the .data attribute. If the input supplied to the element constructor cannot be put into the requested format, the next format listed will be used until a suitable format is found (or the data fails to be understood).
level = Number(allow_None=True, inclusive_bounds=(True, True), label='Level')
Optional level associated with the set of Contours.
- classmethod from_records(records, dataset=None, on=None, value=None, index=None, drop_missing=False, element=None, **kwargs)[source]#
Load data from a collection of cartopy.io.shapereader.Record objects and optionally merge it with a dataset to assign values to each polygon and form a chloropleth. Supplying just records will return an NdOverlayof Shape Elements with a numeric index. If a dataset is supplied, a mapping between the attribute names in the records and the dimension names in the dataset must be supplied. The values assigned to each shape file can then be drawn from the dataset by supplying a
value
and keys the Shapes are indexed by specifying one or index dimensions.- Parameters:
- records
python:list
of
cartopy.io.shapereader.Record
Iterator containing Records.
- dataset
holoviews.Dataset
Any HoloViews Dataset type.
- on
python:str
orpython:list
orpython:dict
A mapping between the attribute names in the records and the dimensions in the dataset.
- value
python:str
The value dimension in the dataset the values will be drawn from.
- index
python:str
orpython:list
One or more dimensions in the dataset the Shapes will be indexed by.
- drop_missingbool
Whether to drop shapes which are missing from the provides dataset.
- records
- Returns:
- classmethod from_shapefile(shapefile, *args, **kwargs)[source]#
Loads a shapefile from disk and optionally merges it with a dataset. See
from_records
for full signature.- Parameters:
- records
python:list
of
cartopy.io.shapereader.Record
Iterator containing Records.
- dataset
holoviews.Dataset
Any HoloViews Dataset type.
- on
python:str
orpython:list
orpython:dict
A mapping between the attribute names in the records and the dimensions in the dataset.
- value
python:str
The value dimension in the dataset the values will be drawn from.
- index
python:str
orpython:list
One or more dimensions in the dataset the Shapes will be indexed by.
- drop_missingbool
Whether to drop shapes which are missing from the provides dataset.
- records
- Returns:
- geom(union=False, projection=None)[source]#
Returns the Shape as a shapely geometry
- Parameters:
- unionbool, default=False
Whether to compute a union between the geometries
- projection
EPSG
python:str
|Cartopy
CRS
|python:None
Whether to project the geometry to other coordinate system
- Returns:
A
shapely
geometry
- class geoviews.Store[source]#
Bases:
object
The Store is what links up HoloViews objects to their corresponding options and to the appropriate classes of the chosen backend (e.g. for rendering).
In addition, Store supports pickle operations that automatically pickle and unpickle the corresponding options for a HoloViews object.
Methods
info
(obj[, ansi, backend, visualization, ...])Show information about a particular object or component class including the applicable style and plot options.
options
- classmethod add_style_opts(component, new_options, backend=None)[source]#
Given a component such as an Element (e.g. Image, Curve) or a container (e.g. Layout) specify new style options to be accepted by the corresponding plotting class.
Note : This is supplied for advanced users who know which additional style keywords are appropriate for the corresponding plotting class.
- classmethod dump(obj, file, protocol=0)[source]#
Equivalent to pickle.dump except that the HoloViews option tree is saved appropriately.
- classmethod dumps(obj, protocol=0)[source]#
Equivalent to pickle.dumps except that the HoloViews option tree is saved appropriately.
- classmethod info(obj, ansi=True, backend='matplotlib', visualization=True, recursive=False, pattern=None, elements=None)[source]#
Show information about a particular object or component class including the applicable style and plot options. Returns None if the object is not parameterized.
- classmethod load(filename)[source]#
Equivalent to pickle.load except that the HoloViews trees is restored appropriately.
- classmethod loaded_backends()[source]#
Returns a list of the backends that have been loaded, based on the available OptionTrees.
- classmethod loads(pickle_string)[source]#
Equivalent to pickle.loads except that the HoloViews trees is restored appropriately.
- classmethod lookup(backend, obj)[source]#
Given an object, lookup the corresponding customized option tree if a single custom tree is applicable.
- output_settings[source]#
alias of
OutputSettings
- classmethod register(associations, backend, style_aliases=None)[source]#
Register the supplied dictionary of associations between elements and plotting classes to the specified backend.
- classmethod render(obj)[source]#
Using any display hooks that have been registered, render the object to a dictionary of MIME types and metadata information.
- classmethod set_current_backend(backend)[source]#
Use this method to set the backend to run the switch hooks
- class geoviews.Text(x, y, text, fontsize=12, halign='center', valign='center', rotation=0, **params)[source]#
Bases:
Text
,_Element
An annotation containing some text at an x, y coordinate along with a coordinate reference system.
Parameter Definitions
Parameters inherited from:
holoviews.core.dimension.LabelledData
: labelholoviews.core.dimension.Dimensioned
: cdims, vdimsholoviews.core.element.Element2D
: extentsgeoviews.element.geo._Element
: crsholoviews.element.annotation.Annotation
: kdimsholoviews.element.annotation.Text
: group, x, y, text, fontsize, rotation, halign, valign
- class geoviews.Tiles(data, kdims=None, vdims=None, **params)[source]#
Bases:
WMTS
Tiles represents an image tile source to dynamically load data from depending on the zoom level.
Parameter Definitions
Parameters inherited from:
holoviews.core.dimension.LabelledData
: labelholoviews.core.dimension.Dimensioned
: cdims, vdimsholoviews.core.element.Element2D
: extentsgeoviews.element.geo._Element
: kdimsgeoviews.element.geo.WMTS
: crs, layergroup = String(default='Tiles', label='Group')
A string describing the data wrapped by the object.
- class geoviews.TriMesh(data=None, kdims=None, vdims=None, **kwargs)[source]#
-
- Attributes:
edgepaths
Returns the fixed EdgePaths or computes direct connections between supplied nodes.
Methods
Parameter Definitions
Parameters inherited from:
holoviews.core.dimension.LabelledData
: labelholoviews.core.dimension.Dimensioned
: cdims, vdimsholoviews.core.element.Element2D
: extentsholoviews.core.data.Dataset
: datatypegeoviews.element.geo._Element
: crsgroup = String(constant=True, default='TriMesh', label='Group')
A string describing the data wrapped by the object.
- property edgepaths#
Returns the fixed EdgePaths or computes direct connections between supplied nodes.
- class geoviews.VectorField(data=None, kdims=None, vdims=None, **kwargs)[source]#
Bases:
_Element
,VectorField
A VectorField contains is a collection of vectors where each vector has an associated position. The vectors should be specified by defining an angle in radians and a magnitude.
Parameter Definitions
Parameters inherited from:
holoviews.core.dimension.LabelledData
: labelholoviews.core.dimension.Dimensioned
: cdimsholoviews.core.element.Element2D
: extentsholoviews.core.data.Dataset
: datatypegeoviews.element.geo._Element
: kdims, crsgroup = String(constant=True, default='VectorField', label='Group')
A string describing the data wrapped by the object.
vdims = List(bounds=(1, None), default=[Dimension('Angle'), Dimension('Magnitude')], label='Vdims')
Value dimensions can be associated with a geometry.
- class geoviews.WMTS(data, kdims=None, vdims=None, **params)[source]#
Bases:
_GeoFeature
The WMTS Element represents a Web Map Tile Service specified as URL containing different template variables or xyzservices.TileProvider.
These variables correspond to three different formats for specifying the spatial location and zoom level of the requested tiles:
Web mapping tiles sources containing {x}, {y}, and {z} variables
Bounding box tile sources containing {XMIN}, {XMAX}, {YMIN}, {YMAX} variables
Quadkey tile sources containing a {Q} variable
Tiles are defined in a pseudo-Mercator projection (EPSG:3857) defined as eastings and northings. Any data overlaid on a tile source therefore has to be defined in those coordinates or be projected.
Parameter Definitions
Parameters inherited from:
holoviews.core.dimension.LabelledData
: labelholoviews.core.dimension.Dimensioned
: cdims, vdimsholoviews.core.element.Element2D
: extentsgeoviews.element.geo._Element
: kdimsgroup = String(default='WMTS', label='Group')
A string describing the data wrapped by the object.
crs = ClassSelector(class_=<class 'cartopy.crs.CRS'>, default=<Bound CRS: +proj=merc +a=6378137.0 +b=6378137.0 +nadgrids=@nu ...> Name: unknown Axis Info [cartesian]: - E[east]: Easting (metre) - N[north]: Northing (metre) Area of Use: - undefined Coordinate Operation: - name: unknown to WGS84 - method: NTv2 Datum: unknown using nadgrids=@null - Ellipsoid: unknown - Prime Meridian: Greenwich Source CRS: unknown , label='Crs')
Cartopy coordinate-reference-system specifying the coordinate system of the data. Inferred automatically when _Element wraps cartopy Feature object.
layer = String(default='', label='Layer')
The layer on the tile service
- class geoviews.WindBarbs(data=None, kdims=None, vdims=None, **kwargs)[source]#
Bases:
_Element
,Selection2DExpr
,Geometry
Methods
from_uv
Parameter Definitions
Parameters inherited from:
holoviews.core.dimension.LabelledData
: labelholoviews.core.dimension.Dimensioned
: cdimsholoviews.core.element.Element2D
: extentsholoviews.core.data.Dataset
: datatypegeoviews.element.geo._Element
: kdims, crsgroup = String(constant=True, default='WindBarbs', label='Group')
A string describing the data wrapped by the object.
vdims = List(bounds=(2, None), default=[Dimension('Angle'), Dimension('Magnitude')], label='Vdims')
Value dimensions can be associated with a geometry.
- class geoviews.annotate(*, annotations, annotator, edit_vertices, empty_value, num_objects, show_vertices, table_opts, table_transforms, vertex_annotations, vertex_style, name)[source]#
Bases:
ParameterizedFunction
The annotate function allows drawing, editing and annotating any given Element (if it is supported). The annotate function returns a Layout of the editable plot and an Overlay of table(s), which allow editing the data of the element. The edited and annotated data may be accessed using the element and selected properties.
- Attributes:
- annotated
- selected
Methods
compose
(*annotators)Composes multiple annotator layouts and elements
Parameter Definitions
annotator = Parameter(allow_None=True, label='Annotator')
The current Annotator instance.
annotations = ClassSelector(class_=(<class 'dict'>, <class 'list'>), default=[], label='Annotations')
Annotations to associate with each object.
edit_vertices = Boolean(default=True, label='Edit vertices')
Whether to add tool to edit vertices.
empty_value = Parameter(allow_None=True, label='Empty value')
The value to insert on annotation columns when drawing a new element.
num_objects = Integer(allow_None=True, bounds=(0, None), inclusive_bounds=(True, True), label='Num objects')
The maximum number of objects to draw.
show_vertices = Boolean(default=True, label='Show vertices')
Whether to show vertices when drawing the Path.
table_transforms = HookList(bounds=(0, None), default=[], label='Table transforms')
Transform(s) to apply to element when converting data to Table. The functions should accept the Annotator and the transformed element as input.
table_opts = Dict(class_=<class 'dict'>, default={'editable': True, 'width': 400}, label='Table opts')
Opts to apply to the editor table(s).
vertex_annotations = ClassSelector(class_=(<class 'dict'>, <class 'list'>), default=[], label='Vertex annotations')
Columns to annotate the Polygons with.
vertex_style = Dict(class_=<class 'dict'>, default={'nonselection_alpha': 0.5}, label='Vertex style')
Options to apply to vertices during drawing and editing.
- classmethod compose(*annotators)[source]#
Composes multiple annotator layouts and elements
The composed Layout will contain all the elements in the supplied annotators and an overlay of all editor tables.
- Parameters:
- annotators
Annotator layouts or elements to compose
- Returns:
A
new
layout
consisting
of
the
overlaid
plots
and
tables
- class geoviews.dim(obj, *args, **kwargs)[source]#
Bases:
object
dim transform objects are a way to express deferred transforms on Datasets. dim transforms support all mathematical and bitwise operators, NumPy ufuncs and methods, and provide a number of useful methods for normalizing, binning and categorizing data.
- Attributes:
- iloc
Methods
apply
(dataset[, flat, expanded, ranges, ...])Evaluates the transform on the supplied dataset.
clone
([dimension, ops, dim_type])Creates a clone of the dim expression optionally overriding the dim and ops.
- applies(dataset, strict=False)[source]#
Determines whether the dim transform can be applied to the Dataset, i.e. whether all referenced dimensions can be resolved.
- apply(dataset, flat=False, expanded=None, ranges=None, all_values=False, keep_index=False, compute=True, strict=False)[source]#
Evaluates the transform on the supplied dataset.
- Parameters:
- dataset
Dataset object to evaluate the expression on
- flat
Whether to flatten the returned array
- expanded
Whether to use the expanded expand values
- ranges
Dictionary for ranges for normalization
- all_values
Whether to evaluate on all values Whether to evaluate on all available values, for some element types, such as Graphs, this may include values not included in the referenced column
- keep_index
For data types that support indexes, whether the index should be preserved in the result.
- compute
For data types that support lazy evaluation, whether the result should be computed before it is returned.
- strict
Whether to strictly check for dimension matches (if False, counts any dimensions with matching names as the same)
- Returns:
values
NumPy array computed by evaluating the expression
- bin(bins, labels=None)[source]#
Bins continuous values.
Bins continuous using the provided bins and assigns labels either computed from each bins center point or from the supplied labels.
- categorize(categories, default=None)[source]#
Replaces discrete values with supplied categories
Replaces discrete values in input array into a fixed set of categories defined either as a list or dictionary.
- Parameters:
- categories
List or dict of categories to map inputs to
- default
Default value to assign if value not in categories
- clone(dimension=None, ops=None, dim_type=None)[source]#
Creates a clone of the dim expression optionally overriding the dim and ops.
- lognorm(limits=None)[source]#
- Unity-based normalization log scale.
Apply the same transformation as matplotlib.colors.LogNorm
- Parameters:
- limits
tuple of (min, max) defining the normalization range
- norm(limits=None)[source]#
Unity-based normalization to scale data into 0-1 range.
(values - min) / (max - min)
- Parameters:
- limits
tuple of (min, max) defining the normalization range
- classmethod pipe(func, *args, **kwargs)[source]#
Wrapper to give multidimensional transforms a more intuitive syntax. For a custom function func with signature (*args, **kwargs), call as dim.pipe(func, *args, **kwargs).
- classmethod register(key, function)[source]#
Register a custom dim transform function which can from then on be referenced by the key.
- property str#
Casts values to strings or provides str accessor.
- class geoviews.extension(*, name)[source]#
Bases:
extension
Helper utility used to load holoviews extensions. These can be plotting extensions, element extensions or anything else that can be registered to work with HoloViews.
The plotting extension is the most commonly used and is used to select the plotting backend. The plotting extension can be loaded using the backend name, e.g. ‘bokeh’, ‘matplotlib’ or ‘plotly’.
Methods
register_backend_callback
(backend, callback)Registers a hook which is run when a backend is loaded
Examples
Activate the bokeh plotting extension:
`python import holoviews as hv hv.extension("bokeh") `
Parameter Definitions
- geoviews.from_xarray(da, crs=None, apply_transform=False, nan_nodata=False, **kwargs)[source]#
Returns an RGB or Image element given an xarray DataArray loaded using xr.open_rasterio.
If a crs attribute is present on the loaded data it will attempt to decode it into a cartopy projection otherwise it will default to a non-geographic HoloViews element.
- Parameters:
- da
xarray.DataArray
DataArray to convert to element
- crs
Cartopy
CRS
orEPSG
python:str
,optional
Overrides CRS inferred from the data
- apply_transformbool
Whether to apply affine transform if defined on the data
- nan_nodatabool
If data contains nodata values convert them to NaNs
- **kwargs
Keyword arguments passed to the HoloViews/GeoViews element
- da
- Returns:
element
Image/RGB/QuadMesh element
- geoviews.help(obj, visualization=True, ansi=True, backend=None, recursive=False, pattern=None)[source]#
Extended version of the built-in help that supports parameterized functions and objects. A pattern (regular expression) may be used to filter the output and if recursive is set to True, documentation for the supplied object is shown. Note that the recursive option will only work with an object instance and not a class.
If
ansi
is set to False, all ANSI color codes are stripped out.
- class geoviews.opts(*args, **params)[source]#
Bases:
ParameterizedFunction
Utility function to set options at the global level or to provide an Options object that can be used with the .options method of an element or container.
Option objects can be generated and validated in a tab-completable way (in appropriate environments such as Jupyter notebooks) using completers such as opts.Curve, opts.Image, opts.Overlay, etc.
To set opts globally you can pass these option objects into opts.defaults:
opts.defaults(*options)
For instance:
opts.defaults(opts.Curve(color=’red’))
To set opts on a specific object, you can supply these option objects to the .options method.
For instance:
curve = hv.Curve([1,2,3]) curve.options(opts.Curve(color=’red’))
The options method also accepts lists of Option objects.
Methods
apply_groups
(obj[, options, backend, clone])Applies nested options definition grouped by type.
defaults
(*options, **kwargs)Set default options for a session.
Parameter Definitions
strict = Boolean(default=False, label='Strict')
Whether to be strict about the options specification. If not set to strict (default), any invalid keywords are simply skipped. If strict, invalid keywords prevent the options being applied.
- classmethod apply_groups(obj, options=None, backend=None, clone=True, **kwargs)[source]#
Applies nested options definition grouped by type.
Applies options on an object or nested group of objects, returning a new object with the options applied. This method accepts the separate option namespaces explicitly (i.e. ‘plot’, ‘style’, and ‘norm’).
If the options are to be set directly on the object a simple format may be used, e.g.:
- opts.apply_groups(obj, style={‘cmap’: ‘viridis’},
plot={‘show_title’: False})
If the object is nested the options must be qualified using a type[.group][.label] specification, e.g.:
- opts.apply_groups(obj, {‘Image’: {‘plot’: {‘show_title’: False},
‘style’: {‘cmap’: ‘viridis}}})
If no opts are supplied all options on the object will be reset.
- Parameters:
- options
python:dict
Options specification Options specification should be indexed by type[.group][.label] or option type (‘plot’, ‘style’, ‘norm’).
- backend
optional
Backend to apply options to Defaults to current selected backend
- clonebool,
optional
Whether to clone object Options can be applied inplace with clone=False
- **kwargs: Keywords of options by type
Applies options directly to the object by type (e.g. ‘plot’, ‘style’, ‘norm’) specified as dictionaries.
- options
- Returns:
Returns
the
object
ora
clone
with
the
options
applied
- class geoviews.output(*args, **params)[source]#
Bases:
ParameterizedFunction
Helper used to set HoloViews display options. Arguments are supplied as a series of keywords in any order:
backend : The backend used by HoloViews fig : The static figure format holomap : The display type for holomaps widgets : The widget mode for widgets fps : The frames per second used for animations max_frames : The max number of frames rendered (default 500) size : The percentage size of displayed output dpi : The rendered dpi of the figure filename : The filename of the saved output, if any (default None) info : The information to page about the displayed objects (default False) css : Optional css style attributes to apply to the figure image tag widget_location : The position of the widgets relative to the plot
Methods
info
Parameter Definitions
- class geoviews.project(*, projection, dynamic, group, input_ranges, link_inputs, streams, name)[source]#
Bases:
Operation
Projects GeoViews Element types to the specified projection.
Parameter Definitions
Parameters inherited from:
holoviews.core.operation.Operation
: group, dynamic, input_ranges, link_inputs, streamsprojection = ClassSelector(class_=<class 'cartopy.crs.Projection'>, default=<Bound CRS: +proj=merc +a=6378137.0 +b=6378137.0 +nadgrids=@nu ...> Name: unknown Axis Info [cartesian]: - E[east]: Easting (metre) - N[north]: Northing (metre) Area of Use: - undefined Coordinate Operation: - name: unknown to WGS84 - method: NTv2 Datum: unknown using nadgrids=@null - Ellipsoid: unknown - Prime Meridian: Greenwich Source CRS: unknown , label='Projection')
Projection the image type is projected to.
- geoviews.render(obj, backend=None, **kwargs)[source]#
Renders the HoloViews object to the corresponding object in the specified backend, e.g. a Matplotlib or Bokeh figure.
The backend defaults to the currently declared default backend. The resulting object can then be used with other objects in the specified backend. For instance, if you want to make a multi-part Bokeh figure using a plot type only available in HoloViews, you can use this function to return a Bokeh figure that you can use like any hand-constructed Bokeh figure in a Bokeh layout.
- Parameters:
- obj
HoloViews
object
The HoloViews object to render
- backend
python:str
A valid HoloViews rendering backend
- **kwargs: dict
Additional keyword arguments passed to the renderer, e.g. fps for animations
- obj
- Returns:
rendered
The rendered representation of the HoloViews object, e.g. if backend=’matplotlib’ a matplotlib Figure or FuncAnimation
- geoviews.renderer(name)[source]#
Helper utility to access the active renderer for a given extension.
- geoviews.save(obj, filename, fmt='auto', backend=None, resources='cdn', toolbar=None, title=None, **kwargs)[source]#
Saves the supplied object to file.
The available output formats depend on the backend being used. By default and if the filename is a string the output format will be inferred from the file extension. Otherwise an explicit format will need to be specified. For ambiguous file extensions such as html it may be necessary to specify an explicit fmt to override the default, e.g. in the case of ‘html’ output the widgets will default to fmt=’widgets’, which may be changed to scrubber widgets using fmt=’scrubber’.
- Parameters:
- obj
HoloViews
object
The HoloViews object to save to file
- filename
python:str
orIO
object
The filename or BytesIO/StringIO object to save to
- fmt
python:str
The format to save the object as, e.g. png, svg, html, or gif and if widgets are desired either ‘widgets’ or ‘scrubber’
- backend
python:str
A valid HoloViews rendering backend, e.g. bokeh or matplotlib
- resources
python:str
orbokeh.resource.Resources
Bokeh resources used to load bokehJS components. Defaults to CDN, to embed resources inline for offline usage use ‘inline’ or bokeh.resources.INLINE.
- toolbarbool or
python:None
Whether to include toolbars in the exported plot. If None, display the toolbar unless fmt is png and backend is bokeh. If True, always include the toolbar. If False, do not include the toolbar.
- title
python:str
Custom title for exported HTML file
- **kwargs: dict
Additional keyword arguments passed to the renderer, e.g. fps for animations
- obj