tikzfigure.core.scope
Classes
| Name | Description |
|---|---|
Scope | A TikZ scope block with local options and nested content. |
Scopeclass#
class Scope(label: str = '', comment: str | None = None, layer: int = 0, options: OptionInput | None = None, node_resolver: Callable[[str], Node | Coordinate] | None = None, library_loader: Callable[[str], None] | None = None, **kwargs: Any)Bases: FigurePathMixin, TikzObject
A TikZ scope block with local options and nested content.
coordinateattributeclass attributeinstance attribute#
coordinate = add_coordinateloopattributeclass attributeinstance attribute#
loop = add_loopnodeattributeclass attributeinstance attribute#
node = add_nodeplotattributeclass attributeinstance attribute#
plot = add_plotrawattributeclass attributeinstance attribute#
raw = add_rawscopeattributeclass attributeinstance attribute#
scope = add_scopespyattributeclass attributeinstance attribute#
spy = add_spyspy_scopeattributeclass attributeinstance attribute#
spy_scope = add_spy_scopeaddmethod#
def add(items: Any) -> NoneAdd one or more pre-built TikZ objects to this scope.
Parameters
| Name | Type | Description |
|---|---|---|
items | Any | A single TikZ object or a list/tuple of them. |
add_coordinatemethod#
def add_coordinate(label: str, x: Any = None, y: Any = None, z: Any = None, at: str | None = None, comment: str | None = None) -> Coordinateadd_loopmethod#
def add_loop(variable: str, values: list[Any] | tuple[Any, ...] | range, comment: str | None = None) -> Anyadd_nodemethod#
def add_node(*args: Any, **kwargs: Any) -> Nodeadd_plotmethod#
def add_plot(x: Any, y: Any | None = None, *, variable: str = 'x', domain: tuple[Any, Any] | str | None = None, samples: int | None = None, smooth: bool = False, comment: str | None = None, options: OptionInput | None = None, tikz_command: str = 'draw', **kwargs: Any) -> TikzPlotAdd a plain TikZ expression plot inside this scope.
add_rawmethod#
def add_raw(tikz_code: str) -> RawTikzadd_scopemethod#
def add_scope(comment: str | None = None, options: OptionInput | None = None, **kwargs: Any) -> Scopeadd_spymethod#
def add_spy(on: Any, *, comment: str | None = None, options: OptionInput | None = None, magnification: float | None = None, lens: OptionInput | str | None = None, lens_kwargs: dict[str, Any] | None = None, size: str | object | None = None, width: str | object | None = None, height: str | object | None = None, connect_spies: bool = False, at: Any = None, node_label: str | None = None, node_options: OptionInput | None = None, node_style: dict[str, Any] | None = None, **kwargs: Any) -> SpyAdd a \spy command inside this scope.
This is the scoped counterpart to TikzFigure.spy(...) and is most
useful inside a spy scope created with scope.spy_scope(...) or
figure.spy_scope(...).
add_spy_scopemethod#
def add_spy_scope(comment: str | None = None, mode: SpyScopeMode = 'scope', options: OptionInput | None = None, magnification: float | None = None, lens: OptionInput | str | None = None, lens_kwargs: dict[str, Any] | None = None, size: str | object | None = None, width: str | object | None = None, height: str | object | None = None, connect_spies: bool = False, every_spy_in_node_options: OptionInput | None = None, every_spy_in_node_style: dict[str, Any] | None = None, every_spy_on_node_options: OptionInput | None = None, every_spy_on_node_style: dict[str, Any] | None = None, spy_connection_path: str | None = None, **kwargs: Any) -> ScopeCreate a nested scope configured for local spy defaults.
The returned scope can be used as a context manager. Its local options
are translated to TikZ spy scope, spy using outlines, or
spy using overlays settings depending on mode.
copymethod#
def copy(**overrides: Any) -> Scopefrom_dictmethodclassmethod#
def from_dict(d: dict[str, Any], node_lookup: dict[str, Node | Coordinate] | None = None) -> Scopeget_nodemethod#
def get_node(node_label: str) -> Node | Coordinateto_dictmethod#
def to_dict() -> dict[str, Any]to_tikzmethod#
def to_tikz(output_unit: str | None = None) -> strInherited from tikzfigure.core.figure_paths.FigurePathMixin
clipmethod#
tikzfigure.core.figure_paths.FigurePathMixinView sourcedef clip(nodes: list, layer: int = 0, comment: str | None = None, center: bool = False, verbose: bool = False, options: OptionInput | None = None, cycle: bool = False, segment_options: list[SegmentOption] | None = None, rotate: float | None = None, xshift: str | None = None, yshift: str | None = None, scale: float | None = None, rounded_corners: str | None = None, **kwargs: Any) -> TikzPathAdd a clipping path using \clip.
drawmethod#
tikzfigure.core.figure_paths.FigurePathMixinView sourcedef draw(nodes: list | NodePathBuilder, layer: int = 0, comment: str | None = None, center: bool = False, verbose: bool = False, options: OptionInput | None = None, cycle: bool = False, segment_options: list[SegmentOption] | None = None, color: ColorInput | None = None, fill: ColorInput | None = None, draw: ColorInput | None = None, text: ColorInput | None = None, opacity: float | None = None, draw_opacity: float | None = None, fill_opacity: float | None = None, text_opacity: float | None = None, line_width: str | float | None = None, line_cap: _LineCap = None, line_join: _LineJoin = None, miter_limit: float | None = None, dash_pattern: str | None = None, dash_phase: str | None = None, double: ColorInput | None = None, double_distance: str | None = None, rounded_corners: str | None = None, rotate: float | None = None, xshift: str | None = None, yshift: str | None = None, scale: float | None = None, xscale: float | None = None, yscale: float | None = None, xslant: float | None = None, yslant: float | None = None, bend_left: float | None = None, bend_right: float | None = None, in_angle: float | None = None, out_angle: float | None = None, looseness: float | None = None, in_looseness: float | None = None, out_looseness: float | None = None, min_distance: str | None = None, max_distance: str | None = None, tension: float | None = None, pattern: _Pattern = None, pattern_color: ColorInput | None = None, shading: _Shading = None, shading_angle: float | None = None, left_color: ColorInput | None = None, right_color: ColorInput | None = None, top_color: ColorInput | None = None, bottom_color: ColorInput | None = None, middle_color: ColorInput | None = None, inner_color: ColorInput | None = None, outer_color: ColorInput | None = None, ball_color: ColorInput | None = None, decoration: _Decoration = None, step: str | None = None, pos: float | None = None, arrows: ArrowInput | None = None, font: str | None = None, name_path: str | None = None, to_path: str | None = None, domain: str | None = None, samples: int | None = None, mark: _Mark = None, mark_size: str | None = None, **kwargs: Any) -> TikzPathAdd a path connecting multiple nodes with \draw.
fillmethod#
tikzfigure.core.figure_paths.FigurePathMixinView sourcedef fill(nodes: list, layer: int = 0, comment: str | None = None, center: bool = False, verbose: bool = False, options: OptionInput | None = None, cycle: bool = False, segment_options: list[SegmentOption] | None = None, fill: ColorInput | None = None, fill_opacity: float | None = None, opacity: float | None = None, pattern: _Pattern = None, pattern_color: ColorInput | None = None, shading: _Shading = None, shading_angle: float | None = None, left_color: ColorInput | None = None, right_color: ColorInput | None = None, top_color: ColorInput | None = None, bottom_color: ColorInput | None = None, middle_color: ColorInput | None = None, inner_color: ColorInput | None = None, outer_color: ColorInput | None = None, ball_color: ColorInput | None = None, rotate: float | None = None, xshift: str | None = None, yshift: str | None = None, scale: float | None = None, xscale: float | None = None, yscale: float | None = None, even_odd_rule: bool = False, **kwargs: Any) -> TikzPathFill a closed path with no stroke using \fill.
filldrawmethod#
tikzfigure.core.figure_paths.FigurePathMixinView sourcedef filldraw(nodes: list | NodePathBuilder, layer: int = 0, comment: str | None = None, center: bool = False, verbose: bool = False, options: OptionInput | None = None, cycle: bool = False, segment_options: list[SegmentOption] | None = None, color: ColorInput | None = None, fill: ColorInput | None = None, draw: ColorInput | None = None, text: ColorInput | None = None, opacity: float | None = None, draw_opacity: float | None = None, fill_opacity: float | None = None, text_opacity: float | None = None, line_width: str | None = None, line_cap: _LineCap = None, line_join: _LineJoin = None, miter_limit: float | None = None, dash_pattern: str | None = None, dash_phase: str | None = None, double: ColorInput | None = None, double_distance: str | None = None, rounded_corners: str | None = None, rotate: float | None = None, xshift: str | None = None, yshift: str | None = None, scale: float | None = None, xscale: float | None = None, yscale: float | None = None, xslant: float | None = None, yslant: float | None = None, bend_left: float | None = None, bend_right: float | None = None, in_angle: float | None = None, out_angle: float | None = None, looseness: float | None = None, in_looseness: float | None = None, out_looseness: float | None = None, min_distance: str | None = None, max_distance: str | None = None, tension: float | None = None, pattern: _Pattern = None, pattern_color: ColorInput | None = None, shading: _Shading = None, shading_angle: float | None = None, left_color: ColorInput | None = None, right_color: ColorInput | None = None, top_color: ColorInput | None = None, bottom_color: ColorInput | None = None, middle_color: ColorInput | None = None, inner_color: ColorInput | None = None, outer_color: ColorInput | None = None, ball_color: ColorInput | None = None, decoration: _Decoration = None, step: str | None = None, pos: float | None = None, arrows: ArrowInput | None = None, font: str | None = None, name_path: str | None = None, to_path: str | None = None, domain: str | None = None, samples: int | None = None, mark: _Mark = None, mark_size: str | None = None, **kwargs: Any) -> TikzPathAdd a filled path connecting multiple nodes with \filldraw.
pathmethod#
tikzfigure.core.figure_paths.FigurePathMixinView sourcedef path(nodes: list, layer: int = 0, comment: str | None = None, center: bool = False, verbose: bool = False, options: OptionInput | None = None, cycle: bool = False, segment_options: list[SegmentOption] | None = None, name_path: str | None = None, pos: float | None = None, rotate: float | None = None, xshift: str | None = None, yshift: str | None = None, scale: float | None = None, **kwargs: Any) -> TikzPathAdd an invisible path using \path.
Inherited from tikzfigure.core.base.TikzObject
commentproperty#
tikzfigure.core.base.TikzObjectView sourcecomment: str | NoneComment prepended to the generated TikZ code, or None.
kwargsproperty#
tikzfigure.core.base.TikzObjectView sourcekwargs: dictKeyword-style TikZ options as a plain dict.
labelproperty#
tikzfigure.core.base.TikzObjectView sourcelabel: str | NoneUnique identifier for this object within the figure.
layerproperty#
tikzfigure.core.base.TikzObjectView sourcelayer: int | NoneLayer index this object belongs to.
optionsproperty#
tikzfigure.core.base.TikzObjectView sourceoptions: list[OptionValue]Flag-style TikZ options without values.
add_commentmethod#
tikzfigure.core.base.TikzObjectView sourcedef add_comment(string_in: str) -> strPrepend a TikZ comment line to a string if a comment is set.
Parameters
| Name | Type | Description |
|---|---|---|
string_in | str | The TikZ code string to annotate. |
tikz_optionsmethod#
tikzfigure.core.base.TikzObjectView sourcedef tikz_options(output_unit: str | None = None) -> strRender all options as a single TikZ option string.
Combines flag-style options and keyword options into the format
expected inside TikZ square brackets, e.g.
"thick, color=red, line width=1pt".
Parameters
Returns
str- A comma-separated string of TikZ options.
