holoviews.util.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:
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.
- settingsOptional list of keyword arguments to be used as
parameters to the operation (in square brackets).
- class holoviews.util.parser.OptsSpec[source]#
Bases:
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
- classmethod parse(line, ns=None)[source]#
Parse an options specification, returning a dictionary with path keys and {‘plot’:<options>, ‘style’:<options>} values.