# Visualizations¶

The visualizations in Circuit Composer show you different views of how quantum circuits affect the state of a collection of qubits. Each type of visualization is explained in detail below.

Randomness in the simulator

The visualizations come from a single-shot statevector simulator, which is different from the backend specified in the Run settings and the Run button. The simulator creates randomness by generating results based on a seed. The seed is the initial value introduced into the algorithm that generates pseudorandom numbers. Because the seed is fixed during your circuit session, your results will be repeatable. However, when you close your circuit and re-open it, the seed will have a new value, so you may see a different result. You can set the seed yourself by changing the value in the box (up to four digits) after the words Simulator seed above the Composer, and observe how the visualizations for your circuit change.

## View visualizations¶

The visualizations are shown in windows at the bottom of the Composer workspace (except the phase disk, which appears at the end of each qubit wire). You can choose any combination of statevector, measurement probabilities, and q-sphere visualizations to appear at the bottom of the workspace. Select or unselect visualizations in the View menu.

Download one of the visualizations at the bottom of the Composer workspace by clicking the More options menu in the visualization window. You can download visualizations as an SVG, a PNG, or a CSV of the underlying data. You can also download the visualization images of the measurement probabilities and statevector histograms as a PDF.

## Measurement probabilities view¶

8-qubit limit

This view visualizes the measurement probabilities as a histogram. The vertical axis labels the computational basis states. The data labels to the right of the horizontal bars label the measurement probabilities of each computational basis state in terms of percentages. The probabilities are related to the amplitudes of the computational basis states according to .

Consider the following quantum circuit and its measurement probabilities view:

A quantum circuit and its measurement probabilities view.

The circuit puts a qubit in the state . The measurement probabilities are

,

.

## Phase disk¶

15-qubit limit

The phase disk at the terminus of each qubit in Circuit Composer gives the local state of each qubit at the end of the computation. The three components of the phase disk are described below.

Phase

The phase of the qubit state vector in the complex plane is given by the line that extends from the center of the diagram to the edge of the gray disk (which rotates counterclockwise around the center point).

Probability the qubit is in the state

The probability that the qubit is in the state is represented by the blue disk fill.

Reduced purity of the qubit state

The radius of the black ring represents the reduced purity of the qubit state, which for qubit in an -qubit state is given by . The reduced purity for a single qubit is in the range ; a value of one indicates that the qubit is not entangled with any other party. In contrast, a reduced purity of shows that the qubit is left in the completely mixed state, and has some level of entanglement over the remaining qubits, and possibly even the environment.

Example: phase disks for two different qubits

Two examples of the phase disk visualization.

## Q-sphere view¶

5-qubit limit

The q-sphere represents the state of a system of one or more qubits by associating each computational basis state with a point on the surface of a sphere. A node is visible at each point. Each node’s radius is proportional to the magnitude of its basis state’s complex amplitude, whereas the node color indicates the phase of the complex amplitude.

The nodes are laid out on the q-sphere so that the basis state with all zeros (e.g., is at its north pole, and the basis state with all ones (e.g., ) is at its south pole. Basis states with the same number of zeros (or ones) lie on a shared latitude of the q-sphere (e.g., ). Beginning at the north pole of the q-sphere and progressing southward, each successive latitude has basis states with a greater number of ones; the latitude of a basis state is determined by its Hamming distance from the zero state. The q-sphere contains the exact same information content as the statevector, but offers a more compact representation.

Consider the following quantum circuit and its q-sphere:

A quantum circuit and the q-sphere representing the state the circuit creates.

You can select, hold, and drag to rotate the q-sphere. To return the q-sphere to its default orientation, select the rewind-arrow button to the top right of the q-sphere.

Note

It is important to highlight that the q-sphere is not the same as the Bloch sphere, even for a single qubit. Indeed, like the phase disk, the Bloch sphere gives a local view of the statevector, where each qubit is viewed on its own. This is important for, among other things, understanding how noise affects qubits, and what the bipartite entanglement is between the qubit of interest and the remaining . This is why the reduced purity, being a measure of entanglement, is included in the phase disk visualization. However, when trying to understand how registers of qubits (multi-qubit states) behave upon the application of quantum circuits, it is more insightful to take a global view and look at the statevector in its entirety. The q-sphere provides a visual representation of the statevector, and thus this global viewpoint. Therefore, when exploring quantum applications and algorithms on small numbers of qubits, the q-sphere should be the primary visualization method.

## Statevector view¶

6-qubit limit

This view visualizes the statevector as a histogram. The horizontal axis labels the computational basis states. The vertical axis measures the magnitude of the amplitudes associated with each computational basis state. The color of each bar represents the phase angle of each amplitude.

Consider the following quantum circuit and its statevector view:

A quantum circuit and its statevector view.

The color wheel maps phase angle to color. The output state is expressed as a list of complex numbers.

The circuit puts a qubit in the state . The computational basis states are and . The magnitudes of the amplitudes are both . The phases of the amplitudes are and for and , respectively.