Skip to main contentIBM Quantum Documentation

qiskit.visualization.array_to_latex

qiskit.visualization.array_to_latex(array, precision=10, prefix='', source=False, max_size=8)GitHub(opens in a new tab)

Latex representation of a complex numpy array (with dimension 1 or 2)

Parameters

  • array (ndarray) – The array to be converted to latex, must have dimension 1 or 2 and contain only numerical data.

  • precision (int(opens in a new tab)) – For numbers not close to integers or common terms, the number of decimal places to round to.

  • prefix (str(opens in a new tab)) – Latex string to be prepended to the latex, intended for labels.

  • source (bool(opens in a new tab)) – If False, will return IPython.display.Latex object. If display is True, will instead return the LaTeX source string.

  • max_size (list(opens in a new tab)(int(opens in a new tab)) or int(opens in a new tab)) –

    The maximum size of the output Latex array.

    • If list(int), then the 0th element of the list specifies the maximum width (including dots characters) and the 1st specifies the maximum height (also inc. dots characters).
    • If a single int then this value sets the maximum width _and_ maximum height.

Returns

If source is True, a str of the LaTeX

representation of the array, else an IPython.display.Latex representation of the array.

Return type

str(opens in a new tab) or IPython.display.Latex

Raises

Was this page helpful?