qiskit-documentation/docs/api/qiskit/0.26/qiskit.visualization.array_...

50 lines
2.0 KiB
Plaintext
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
title: array_to_latex (v0.26)
description: API reference for qiskit.visualization.array_to_latex in qiskit v0.26
in_page_toc_min_heading_level: 1
python_api_type: function
python_api_name: qiskit.visualization.array_to_latex
---
<span id="qiskit-visualization-array-to-latex" />
# qiskit.visualization.array\_to\_latex
<Function id="qiskit.visualization.array_to_latex" isDedicatedPage={true} github="https://github.com/qiskit/qiskit/tree/stable/0.17/qiskit/visualization/array.py" signature="array_to_latex(array, precision=5, prefix='', source=False, max_size=8)">
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*) For numbers not close to integers or common terms, the number of decimal places to round to.
* **prefix** (*str*) Latex string to be prepended to the latex, intended for labels.
* **source** (*bool*) If `False`, will return IPython.display.Latex object. If display is `True`, will instead return the LaTeX source string.
* **max\_size** (*list(int) or int*)
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 or IPython.display.Latex
**Raises**
* **TypeError** If array can not be interpreted as a numerical numpy array.
* **ValueError** If the dimension of array is not 1 or 2.
* **ImportError** If `source` is `False` and `IPython.display.Latex` cannot be imported.
</Function>