50 lines
2.8 KiB
Plaintext
50 lines
2.8 KiB
Plaintext
---
|
||
title: array_to_latex (v1.2)
|
||
description: API reference for qiskit.visualization.array_to_latex in qiskit v1.2
|
||
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/1.2/qiskit/visualization/array.py#L146-L204" signature="qiskit.visualization.array_to_latex(array, precision=10, 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*](https://docs.python.org/3/library/functions.html#int "(in Python v3.13)")) – For numbers not close to integers or common terms, the number of decimal places to round to.
|
||
|
||
* **prefix** ([*str*](https://docs.python.org/3/library/stdtypes.html#str "(in Python v3.13)")) – Latex string to be prepended to the latex, intended for labels.
|
||
|
||
* **source** ([*bool*](https://docs.python.org/3/library/functions.html#bool "(in Python v3.13)")) – If `False`, will return IPython.display.Latex object. If display is `True`, will instead return the LaTeX source string.
|
||
|
||
* **max\_size** ([*list*](https://docs.python.org/3/library/stdtypes.html#list "(in Python v3.13)")*(*[*int*](https://docs.python.org/3/library/functions.html#int "(in Python v3.13)")*) or* [*int*](https://docs.python.org/3/library/functions.html#int "(in Python v3.13)")) –
|
||
|
||
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](https://docs.python.org/3/library/stdtypes.html#str "(in Python v3.13)") or IPython.display.Latex
|
||
|
||
**Raises**
|
||
|
||
* [**TypeError**](https://docs.python.org/3/library/exceptions.html#TypeError "(in Python v3.13)") – If array can not be interpreted as a numerical numpy array.
|
||
* [**ValueError**](https://docs.python.org/3/library/exceptions.html#ValueError "(in Python v3.13)") – If the dimension of array is not 1 or 2.
|
||
* [**MissingOptionalLibraryError**](exceptions#qiskit.exceptions.MissingOptionalLibraryError "qiskit.exceptions.MissingOptionalLibraryError") – If `source` is `False` and `IPython.display.Latex` cannot be imported.
|
||
</Function>
|
||
|