pylatex.tikz

This module implements the classes used to show plots.

class TikZOptions(*args, **kwargs)[source]

Bases: pylatex.base_classes.command.Options

Options class, do not escape.

Parameters:
  • *args – Positional parameters
  • **kwargs – Keyword parameters
append_positional(option)[source]

Add a new positional option.

class TikZ(*, options=None, arguments=None, start_arguments=None, **kwargs)[source]

Bases: pylatex.base_classes.containers.Environment

Basic TikZ container class.

Parameters:
  • options (str or list or Options) – Options to be added to the \begin command
  • arguments (str or list or Arguments) – Arguments to be added to the \begin command
  • start_arguments (str or list or Arguments) – Arguments to be added before the options
omit_if_empty = False
class Axis(options=None, *, data=None)[source]

Bases: pylatex.base_classes.containers.Environment

PGFPlots axis container class, this contains plots.

Parameters:options (str, list or Options) – Options to format the axis environment.
omit_if_empty = False
class TikZScope(*, options=None, arguments=None, start_arguments=None, **kwargs)[source]

Bases: pylatex.base_classes.containers.Environment

TikZ Scope Environment.

Parameters:
  • options (str or list or Options) – Options to be added to the \begin command
  • arguments (str or list or Arguments) – Arguments to be added to the \begin command
  • start_arguments (str or list or Arguments) – Arguments to be added before the options
omit_if_empty = False
class TikZCoordinate(x, y, relative=False)[source]

Bases: pylatex.base_classes.latex_object.LatexObject

A General Purpose Coordinate Class.

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 TikZObject(options=None)[source]

Bases: pylatex.base_classes.containers.Container

Abstract Class that most TikZ Objects inherits from.

Parameters:options (list) – Options pertaining to the object
class TikZNodeAnchor(node_handle, anchor_name)[source]

Bases: pylatex.base_classes.latex_object.LatexObject

Representation of a node’s anchor point.

Parameters:
  • node_handle (str) – Node’s identifier
  • anchor_name (str) – Name of the anchor
class TikZNode(handle=None, options=None, at=None, text=None)[source]

Bases: pylatex.tikz.TikZObject

A class that represents a TiKZ node.

Parameters:
  • handle (str) – Node identifier
  • options (list) – List of options
  • at (TikZCoordinate) – Coordinate where node is placed
  • text (str) – Body text of the node
get_anchor_point(anchor_name)[source]

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

class TikZUserPath(path_type, options=None)[source]

Bases: pylatex.base_classes.latex_object.LatexObject

Represents a possible TikZ path.

Parameters:
  • path_type (str) – Type of path used
  • options (Options) – List of options to add
class TikZPathList(*args)[source]

Bases: pylatex.base_classes.latex_object.LatexObject

Represents a path drawing.

Parameters:args (list) – A list of path elements
class TikZPath(path=None, options=None)[source]

Bases: pylatex.tikz.TikZObject

The TikZ path command.

Parameters:
  • path (TikZPathList) – A list of the nodes, path types in the path
  • options (TikZOptions) – A list of options for the command
class TikZDraw(path=None, options=None)[source]

Bases: pylatex.tikz.TikZPath

A draw command is just a path command with the draw option.

Parameters:
  • path (TikZPathList) – A list of the nodes, path types in the path
  • options (TikZOptions) – A list of options for the command
class Plot(name=None, func=None, coordinates=None, error_bar=None, options=None)[source]

Bases: pylatex.base_classes.latex_object.LatexObject

A class representing a PGFPlot.

Parameters:
  • name (str) – Name of the plot.
  • func (str) – A function that should be plotted.
  • coordinates (list) – A list of exact coordinates tat should be plotted.
  • options (str, list or Options) –