qiskit-documentation/docs/api/qiskit/0.45/qiskit.visualization.visual...

38 lines
2.5 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: visualize_transition
description: API reference for qiskit.visualization.visualize_transition
in_page_toc_min_heading_level: 1
python_api_type: function
python_api_name: qiskit.visualization.visualize_transition
---
<span id="qiskit-visualization-visualize-transition" />
# qiskit.visualization.visualize\_transition
<Function id="qiskit.visualization.visualize_transition" isDedicatedPage={true} github="https://github.com/qiskit/qiskit/tree/stable/0.45/qiskit/visualization/transition_visualization.py" signature="qiskit.visualization.visualize_transition(circuit, trace=False, saveas=None, fpg=100, spg=2)">
Creates animation showing transitions between states of a single qubit by applying quantum gates.
**Parameters**
* **circuit** ([*QuantumCircuit*](qiskit.circuit.QuantumCircuit "qiskit.circuit.QuantumCircuit")) Qiskit single-qubit QuantumCircuit. Gates supported are h,x, y, z, rx, ry, rz, s, sdg, t, tdg and u1.
* **trace** ([*bool*](https://docs.python.org/3/library/functions.html#bool "(in Python v3.12)")) Controls whether to display tracing vectors - history of 10 past vectors at each step of the animation.
* **saveas** ([*str*](https://docs.python.org/3/library/stdtypes.html#str "(in Python v3.12)")) User can choose to save the animation as a video to their filesystem. This argument is a string of path with filename and extension (e.g. “movie.mp4” to save the video in current working directory).
* **fpg** ([*int*](https://docs.python.org/3/library/functions.html#int "(in Python v3.12)")) Frames per gate. Finer control over animation smoothness and computational needs to render the animation. Works well for tkinter GUI as it is, for jupyter GUI it might be preferable to choose fpg between 5-30.
* **spg** ([*int*](https://docs.python.org/3/library/functions.html#int "(in Python v3.12)")) Seconds per gate. How many seconds should animation of individual gate transitions take.
**Returns**
If arg jupyter is set to True. Otherwise opens tkinter GUI and returns after the GUI is closed.
**Return type**
IPython.core.display.HTML
**Raises**
* [**MissingOptionalLibraryError**](exceptions#qiskit.exceptions.MissingOptionalLibraryError "qiskit.exceptions.MissingOptionalLibraryError") Must have Matplotlib (and/or IPython) installed.
* [**VisualizationError**](visualization#qiskit.visualization.VisualizationError "qiskit.visualization.VisualizationError") Given gate(s) are not supported.
</Function>