pythontikz.positions

This module the TikZ classes which keep track of positions, namely
coordinates and nodes
class pythontikz.positions.TikzNode(handle=None, options=None, at=None, text=None)[source]

Bases: pythontikz.common.TikzObject

A class that represents a TiKZ node.

Parameters:
  • handle (str) – Node identifier
  • options (list or TikzOptions) – List of options
  • at (TikzRectCoord) – Coordinate where node is placed
  • text (str) – Body text of the node
get_anchor_point(anchor_name)

Return an anchor point of the node, if it exists.

class pythontikz.positions.BaseTikzCoord[source]

Bases: pylatex.base_classes.latex_object.LatexObject, abc.ABC

Marker abstract class from which all coordinate classes inherit. Allows for cleaner use of isinstance regarding all coordinate objects.

Note this intentionally breaks the naming convention of Tikz<**>Coord as it not to be used.

This should be a private class, but sphinx throws a reference target not found error if it is.

This should be an abstract class with ABC but could not implement this in a python 2/3 friendly way that also worked with the 3to2 conversion.

class pythontikz.positions.TikzRectCoord(x, y, relative=False)[source]

Bases: pythontikz.positions.BaseTikzCoord

Extension of BaseTikzCoord. Forms a General Purpose Coordinate Class, representing a tuple of points specified, as opposed to the node shortcut command coordinate.

Parameters:
  • x (float or int) – X coordinate
  • y (float or int) – Y coordinate
  • relative (bool) – Coordinate is relative or absolute
classmethod from_str(coordinate)[source]

Build a TikzCoordinate object from a string.

distance_to(other)[source]

Euclidean distance between two coordinates.

class pythontikz.positions.TikzPolCoord(angle, radius, relative=False)[source]

Bases: pythontikz.positions.TikzRectCoord

Class representing the Tikz polar coordinate specification

angle: float or int
angle in degrees
radius: float or int, non-negative
radius from orig
relative: bool
Coordinate is relative or absolute
distance_to(other)

Euclidean distance between two coordinates.

from_str(coordinate)

Build a TikzCoordinate object from a string.

class pythontikz.positions.TikzCalcCoord(handle=None, options=None, at=None, text=None)[source]

Bases: pythontikz.positions.BaseTikzCoord, pythontikz.positions.TikzNode

Represents the coordinate syntax for defining a coordinate handle in TikZ. This itself is a shortcut for a special case of node. Use get_handle method to retrieve object corresponding to use of the coordinate handle (as opposed to the initial definition)

Parameters:
  • handle (str) – Node identifier
  • options (list or TikzOptions) – List of options
  • at (TikzRectCoord) – Coordinate where node is placed
  • text (str) – Body text of the node
get_handle()[source]

Retrieves the associated coordinate handle accessor. # noqa: D401

This handle is for the inline re-referencing of the same coordinate using the label text supplied at definition.

get_anchor_point(anchor_name)

Return an anchor point of the node, if it exists.

class pythontikz.positions.TikzCalcScalar(value)[source]

Bases: pylatex.base_classes.latex_object.LatexObject

Wrapper for multiplication scalar in calc expressions e.g. ($ 4*(3,2.2) $) Written explicitly as a separate class to enable dumps support. Simpler than trying to deal with casting floats and strings without having other string parsing cause issues.

Parameters:value (float or int) – The scalar operator to be applied to the successor coordinate.