holoviews.util Package ¶
util
Package
¶
-
class
holoviews.util.
Dynamic
( **params ) [source] ¶ -
Bases:
param.parameterized.ParameterizedFunction
Dynamically applies a callable to the Elements in any HoloViews object. Will return a DynamicMap wrapping the original map object, which will lazily evaluate when a key is requested. By default Dynamic applies a no-op, making it useful for converting HoloMaps to a DynamicMap.
Any supplied kwargs will be passed to the callable and any streams will be instantiated on the returned DynamicMap. If the supplied operation is a method on a parameterized object which was decorated with parameter dependencies Dynamic will automatically create a stream to watch the parameter changes. This default behavior may be disabled by setting watch=False.
-
param Callable
operation
( allow_None=False, constant=False, instantiate=False, pickle_default_value=True, precedence=None, readonly=False, watchers={} ) - Operation or user-defined callable to apply dynamically
-
param Dict
kwargs
( allow_None=False, constant=False, default={}, instantiate=True, is_instance=True, pickle_default_value=True, precedence=None, readonly=False, watchers={} ) - Keyword arguments passed to the function.
-
param Boolean
link_inputs
( allow_None=False, bounds=(0, 1), constant=False, default=True, instantiate=False, pickle_default_value=True, precedence=None, readonly=False, watchers={} ) - If Dynamic is applied to another DynamicMap, determines whether linked streams attached to its Callable inputs are transferred to the output of the utility. For example if the Dynamic utility is applied to a DynamicMap with an RangeXY, this switch determines whether the corresponding visualization should update this stream with range changes originating from the newly generated axes.
-
param Boolean
shared_data
( allow_None=False, bounds=(0, 1), constant=False, default=False, instantiate=False, pickle_default_value=True, precedence=None, readonly=False, watchers={} ) - Whether the cloned DynamicMap will share the same cache.
-
param List
streams
( allow_None=False, bounds=(0, None), constant=False, default=[], instantiate=True, pickle_default_value=True, precedence=None, readonly=False, watchers={} ) - List of streams to attach to the returned DynamicMap
-
debug
( *args , **kwargs ) ¶ -
Inspect .param.debug method for the full docstring
-
defaults
( *args , **kwargs ) ¶ -
Inspect .param.defaults method for the full docstring
-
force_new_dynamic_value
= functools.partial(<function Parameters.deprecate.<locals>.inner>, <class 'holoviews.util.Dynamic'>) ¶
-
get_param_values
= functools.partial(<function Parameters.deprecate.<locals>.inner>, <class 'holoviews.util.Dynamic'>) ¶
-
get_value_generator
= functools.partial(<function Parameters.deprecate.<locals>.inner>, <class 'holoviews.util.Dynamic'>) ¶
-
inspect_value
= functools.partial(<function Parameters.deprecate.<locals>.inner>, <class 'holoviews.util.Dynamic'>) ¶
-
instance
= functools.partial(<function ParameterizedFunction.instance>, <class 'holoviews.util.Dynamic'>) ¶
-
message
( *args , **kwargs ) ¶ -
Inspect .param.message method for the full docstring
-
params
( *args , **kwargs ) ¶ -
Inspect .param.params method for the full docstring
-
pprint
( imports=None , prefix='\n ' , unknown_value='<?>' , qualify=False , separator='' ) ¶ -
Same as Parameterized.pprint, except that X.classname(Y is replaced with X.classname.instance(Y
-
print_param_defaults
( *args , **kwargs ) ¶ -
Inspect .param.print_param_defaults method for the full docstring
-
print_param_values
( *args , **kwargs ) ¶ -
Inspect .param.print_param_values method for the full docstring
-
script_repr
( imports=[] , prefix=' ' ) ¶ -
Same as Parameterized.script_repr, except that X.classname(Y is replaced with X.classname.instance(Y
-
set_default
( *args , **kwargs ) ¶ -
Inspect .param.set_default method for the full docstring
-
set_dynamic_time_fn
= functools.partial(<function Parameters.deprecate.<locals>.inner>, <class 'holoviews.util.Dynamic'>) ¶
-
set_param
= functools.partial(<function Parameters.deprecate.<locals>.inner>, <class 'holoviews.util.Dynamic'>) ¶
-
state_pop
( ) ¶ -
Restore the most recently saved state.
See state_push() for more details.
-
state_push
( ) ¶ -
Save this instance’s state.
For Parameterized instances, this includes the state of dynamically generated values.
Subclasses that maintain short-term state should additionally save and restore that state using state_push() and state_pop().
Generally, this method is used by operations that need to test something without permanently altering the objects’ state.
-
verbose
( *args , **kwargs ) ¶ -
Inspect .param.verbose method for the full docstring
-
warning
( *args , **kwargs ) ¶ -
Inspect .param.warning method for the full docstring
-
param Callable
-
holoviews.util.
examples
( path='holoviews-examples' , verbose=False , force=False , root='/Users/philippjfr/holoviews/holoviews/util/__init__.py' ) [source] ¶ -
Copies the notebooks to the supplied path.
-
class
holoviews.util.
extension
( **params ) [source] ¶ -
Bases:
pyviz_comms.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.
-
debug
( *args , **kwargs ) ¶ -
Inspect .param.debug method for the full docstring
-
defaults
( *args , **kwargs ) ¶ -
Inspect .param.defaults method for the full docstring
-
force_new_dynamic_value
= functools.partial(<function Parameters.deprecate.<locals>.inner>, <class 'holoviews.util.extension'>) ¶
-
get_param_values
= functools.partial(<function Parameters.deprecate.<locals>.inner>, <class 'holoviews.util.extension'>) ¶
-
get_value_generator
= functools.partial(<function Parameters.deprecate.<locals>.inner>, <class 'holoviews.util.extension'>) ¶
-
inspect_value
= functools.partial(<function Parameters.deprecate.<locals>.inner>, <class 'holoviews.util.extension'>) ¶
-
instance
= functools.partial(<function ParameterizedFunction.instance>, <class 'holoviews.util.extension'>) ¶
-
message
( *args , **kwargs ) ¶ -
Inspect .param.message method for the full docstring
-
params
( *args , **kwargs ) ¶ -
Inspect .param.params method for the full docstring
-
pprint
( imports=None , prefix='\n ' , unknown_value='<?>' , qualify=False , separator='' ) ¶ -
Same as Parameterized.pprint, except that X.classname(Y is replaced with X.classname.instance(Y
-
print_param_defaults
( *args , **kwargs ) ¶ -
Inspect .param.print_param_defaults method for the full docstring
-
print_param_values
( *args , **kwargs ) ¶ -
Inspect .param.print_param_values method for the full docstring
-
script_repr
( imports=[] , prefix=' ' ) ¶ -
Same as Parameterized.script_repr, except that X.classname(Y is replaced with X.classname.instance(Y
-
set_default
( *args , **kwargs ) ¶ -
Inspect .param.set_default method for the full docstring
-
set_dynamic_time_fn
= functools.partial(<function Parameters.deprecate.<locals>.inner>, <class 'holoviews.util.extension'>) ¶
-
set_param
= functools.partial(<function Parameters.deprecate.<locals>.inner>, <class 'holoviews.util.extension'>) ¶
-
state_pop
( ) ¶ -
Restore the most recently saved state.
See state_push() for more details.
-
state_push
( ) ¶ -
Save this instance’s state.
For Parameterized instances, this includes the state of dynamically generated values.
Subclasses that maintain short-term state should additionally save and restore that state using state_push() and state_pop().
Generally, this method is used by operations that need to test something without permanently altering the objects’ state.
-
verbose
( *args , **kwargs ) ¶ -
Inspect .param.verbose method for the full docstring
-
warning
( *args , **kwargs ) ¶ -
Inspect .param.warning method for the full docstring
-
-
class
holoviews.util.
opts
[source] ¶ -
Bases:
param.parameterized.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.
-
param Boolean
strict
( allow_None=False, bounds=(0, 1), constant=False, default=False, instantiate=False, pickle_default_value=True, precedence=None, readonly=False, watchers={} ) - 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.
- Args:
-
- options (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
- clone (bool, 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.
- Returns:
- Returns the object or a clone with the options applied
-
debug
( *args , **kwargs ) ¶ -
Inspect .param.debug method for the full docstring
-
classmethod
defaults
( *options , **kwargs ) [source] ¶ -
Set default options for a session.
Set default options for a session. whether in a Python script or a Jupyter notebook.
- Args:
- * options: Option objects used to specify the defaults. backend: The plotting extension the options apply to
-
force_new_dynamic_value
= functools.partial(<function Parameters.deprecate.<locals>.inner>, <class 'holoviews.util.opts'>) ¶
-
get_param_values
= functools.partial(<function Parameters.deprecate.<locals>.inner>, <class 'holoviews.util.opts'>) ¶
-
get_value_generator
= functools.partial(<function Parameters.deprecate.<locals>.inner>, <class 'holoviews.util.opts'>) ¶
-
inspect_value
= functools.partial(<function Parameters.deprecate.<locals>.inner>, <class 'holoviews.util.opts'>) ¶
-
instance
= functools.partial(<function ParameterizedFunction.instance>, <class 'holoviews.util.opts'>) ¶
-
message
( *args , **kwargs ) ¶ -
Inspect .param.message method for the full docstring
-
params
( *args , **kwargs ) ¶ -
Inspect .param.params method for the full docstring
-
pprint
( imports=None , prefix='\n ' , unknown_value='<?>' , qualify=False , separator='' ) ¶ -
Same as Parameterized.pprint, except that X.classname(Y is replaced with X.classname.instance(Y
-
print_param_defaults
( *args , **kwargs ) ¶ -
Inspect .param.print_param_defaults method for the full docstring
-
print_param_values
( *args , **kwargs ) ¶ -
Inspect .param.print_param_values method for the full docstring
-
script_repr
( imports=[] , prefix=' ' ) ¶ -
Same as Parameterized.script_repr, except that X.classname(Y is replaced with X.classname.instance(Y
-
set_default
( *args , **kwargs ) ¶ -
Inspect .param.set_default method for the full docstring
-
set_dynamic_time_fn
= functools.partial(<function Parameters.deprecate.<locals>.inner>, <class 'holoviews.util.opts'>) ¶
-
set_param
= functools.partial(<function Parameters.deprecate.<locals>.inner>, <class 'holoviews.util.opts'>) ¶
-
state_pop
( ) ¶ -
Restore the most recently saved state.
See state_push() for more details.
-
state_push
( ) ¶ -
Save this instance’s state.
For Parameterized instances, this includes the state of dynamically generated values.
Subclasses that maintain short-term state should additionally save and restore that state using state_push() and state_pop().
Generally, this method is used by operations that need to test something without permanently altering the objects’ state.
-
verbose
( *args , **kwargs ) ¶ -
Inspect .param.verbose method for the full docstring
-
warning
( *args , **kwargs ) ¶ -
Inspect .param.warning method for the full docstring
-
param Boolean
-
class
holoviews.util.
output
( backend=None , fig=None , holomap=None , widgets=None , fps=None , max_frames=None , size=None , dpi=None , filename=None , info=None , css=None ) [source] ¶ -
Bases:
param.parameterized.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
-
debug
( *args , **kwargs ) ¶ -
Inspect .param.debug method for the full docstring
-
defaults
( *args , **kwargs ) ¶ -
Inspect .param.defaults method for the full docstring
-
force_new_dynamic_value
= functools.partial(<function Parameters.deprecate.<locals>.inner>, <class 'holoviews.util.output'>) ¶
-
get_param_values
= functools.partial(<function Parameters.deprecate.<locals>.inner>, <class 'holoviews.util.output'>) ¶
-
get_value_generator
= functools.partial(<function Parameters.deprecate.<locals>.inner>, <class 'holoviews.util.output'>) ¶
-
inspect_value
= functools.partial(<function Parameters.deprecate.<locals>.inner>, <class 'holoviews.util.output'>) ¶
-
instance
= functools.partial(<function ParameterizedFunction.instance>, <class 'holoviews.util.output'>) ¶
-
message
( *args , **kwargs ) ¶ -
Inspect .param.message method for the full docstring
-
params
( *args , **kwargs ) ¶ -
Inspect .param.params method for the full docstring
-
pprint
( imports=None , prefix='\n ' , unknown_value='<?>' , qualify=False , separator='' ) ¶ -
Same as Parameterized.pprint, except that X.classname(Y is replaced with X.classname.instance(Y
-
print_param_defaults
( *args , **kwargs ) ¶ -
Inspect .param.print_param_defaults method for the full docstring
-
print_param_values
( *args , **kwargs ) ¶ -
Inspect .param.print_param_values method for the full docstring
-
script_repr
( imports=[] , prefix=' ' ) ¶ -
Same as Parameterized.script_repr, except that X.classname(Y is replaced with X.classname.instance(Y
-
set_default
( *args , **kwargs ) ¶ -
Inspect .param.set_default method for the full docstring
-
set_dynamic_time_fn
= functools.partial(<function Parameters.deprecate.<locals>.inner>, <class 'holoviews.util.output'>) ¶
-
set_param
= functools.partial(<function Parameters.deprecate.<locals>.inner>, <class 'holoviews.util.output'>) ¶
-
state_pop
( ) ¶ -
Restore the most recently saved state.
See state_push() for more details.
-
state_push
( ) ¶ -
Save this instance’s state.
For Parameterized instances, this includes the state of dynamically generated values.
Subclasses that maintain short-term state should additionally save and restore that state using state_push() and state_pop().
Generally, this method is used by operations that need to test something without permanently altering the objects’ state.
-
verbose
( *args , **kwargs ) ¶ -
Inspect .param.verbose method for the full docstring
-
warning
( *args , **kwargs ) ¶ -
Inspect .param.warning method for the full docstring
-
-
holoviews.util.
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.
- obj: HoloViews object
- The HoloViews object to render
- backend: string
- A valid HoloViews rendering backend
- ** kwargs: dict
- Additional keyword arguments passed to the renderer, e.g. fps for animations
- renderered:
- The rendered representation of the HoloViews object, e.g. if backend=’matplotlib’ a matplotlib Figure or FuncAnimation
-
holoviews.util.
renderer
( name ) [source] ¶ -
Helper utility to access the active renderer for a given extension.
-
holoviews.util.
save
( obj , filename , fmt='auto' , backend=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’.
- obj: HoloViews object
- The HoloViews object to save to file
- filename: string or IO object
- The filename or BytesIO/StringIO object to save to
- fmt: string
- The format to save the object as, e.g. png, svg, html, or gif and if widgets are desired either ‘widgets’ or ‘scrubber’
- backend: string
- A valid HoloViews rendering backend, e.g. bokeh or matplotlib
- ** kwargs: dict
- Additional keyword arguments passed to the renderer, e.g. fps for animations
command
Module
¶
python -m holoviews.util.command Conversion_Example.ipynb OR holoviews Conversion_Example.ipynb
parser
Module
¶
The magics offered by the HoloViews IPython extension are powerful and support rich, compositional specifications. To avoid the the brittle, convoluted code that results from trying to support the syntax in pure Python, this file defines suitable parsers using pyparsing that are cleaner and easier to understand.
Pyparsing is required by matplotlib and will therefore be available if HoloViews is being used in conjunction with matplotlib.
-
class
holoviews.util.parser.
CompositorSpec
[source] ¶ -
Bases:
holoviews.util.parser.Parser
The syntax for defining a set of compositor is as follows:
[ mode op(spec) [settings] value ]+
The components are:
mode : Operation mode, either ‘data’ or ‘display’. group : Value identifier with capitalized initial letter. op : The name of the operation to apply. spec : Overlay specification of form (A * B) where A and B are
dotted path specifications.- settings : Optional list of keyword arguments to be used as
- parameters to the operation (in square brackets).
-
collect_tokens
( parseresult , mode ) ¶ -
Collect the tokens from a (potentially) nested parse result.
-
classmethod
parse
( line , ns={} ) [source] ¶ -
Parse compositor specifications, returning a list Compositors
-
todict
( parseresult , mode='parens' , ns={} ) ¶ -
Helper function to return dictionary given the parse results from a pyparsing.nestedExpr object (containing keywords).
The ns is a dynamic namespace (typically the IPython Notebook namespace) used to update the class-level namespace.
-
class
holoviews.util.parser.
OptsSpec
[source] ¶ -
Bases:
holoviews.util.parser.Parser
An OptsSpec is a string specification that describes an OptionTree. It is a list of tree path specifications (using dotted syntax) separated by keyword lists for any of the style, plotting or normalization options. These keyword lists are denoted ‘plot(..)’, ‘style(…)’ and ‘norm(…)’ respectively. These three groups may be specified even more concisely using keyword lists delimited by square brackets, parentheses and braces respectively. All these sets are optional and may be supplied in any order.
For instance, the following string:
Image (interpolation=None) plot(show_title=False) Curve style(color=’r’)
Would specify an OptionTree where Image has “interpolation=None” for style and ‘show_title=False’ for plot options. The Curve has a style set such that color=’r’.
The parser is fairly forgiving; commas between keywords are optional and additional spaces are often allowed. The only restriction is that keywords must be immediately followed by the ‘=’ sign (no space).
-
classmethod
apply_deprecations
( path ) [source] ¶ -
Convert any potentially deprecated paths and issue appropriate warnings
-
collect_tokens
( parseresult , mode ) ¶ -
Collect the tokens from a (potentially) nested parse result.
-
classmethod
parse
( line , ns={} ) [source] ¶ -
Parse an options specification, returning a dictionary with path keys and {‘plot’:<options>, ‘style’:<options>} values.
-
classmethod
parse_options
( line , ns={} ) [source] ¶ -
Similar to parse but returns a list of Options objects instead of the dictionary format.
-
classmethod
process_normalization
( parse_group ) [source] ¶ -
Given a normalization parse group (i.e. the contents of the braces), validate the option list and compute the appropriate integer value for the normalization plotting option.
-
todict
( parseresult , mode='parens' , ns={} ) ¶ -
Helper function to return dictionary given the parse results from a pyparsing.nestedExpr object (containing keywords).
The ns is a dynamic namespace (typically the IPython Notebook namespace) used to update the class-level namespace.
-
classmethod
-
class
holoviews.util.parser.
Parser
[source] ¶ -
Bases:
object
Base class for magic line parsers, designed for forgiving parsing of keyword lists.
-
classmethod
collect_tokens
( parseresult , mode ) [source] ¶ -
Collect the tokens from a (potentially) nested parse result.
-
classmethod
todict
( parseresult , mode='parens' , ns={} ) [source] ¶ -
Helper function to return dictionary given the parse results from a pyparsing.nestedExpr object (containing keywords).
The ns is a dynamic namespace (typically the IPython Notebook namespace) used to update the class-level namespace.
-
classmethod
settings
Module
¶
-
class
holoviews.util.settings.
KeywordSettings
[source] ¶ -
Bases:
object
Base class for options settings used to specified collections of keyword options.
-
classmethod
extract_keywords
( line , items ) [source] ¶ -
Given the keyword string, parse a dictionary of options.
-
classmethod
-
class
holoviews.util.settings.
OutputSettings
[source] ¶ -
Bases:
holoviews.util.settings.KeywordSettings
Class for controlling display and output settings.
-
extract_keywords
( line , items ) ¶ -
Given the keyword string, parse a dictionary of options.
-
get_options
( items , options , warnfn ) ¶ -
Given a keyword specification, validate and compute options
-
-
holoviews.util.settings.
list_formats
( format_type , backend=None ) [source] ¶ -
Returns list of supported formats for a particular backend.