Main Content

QuantumCircuitChart Properties

Quantum circuit plot appearance and behavior

Since R2023b

Installation Required: This functionality requires MATLAB Support Package for Quantum Computing.

QuantumCircuitChart properties control the appearance and behavior of plotted quantum circuits. By changing property values, you can modify aspects of the circuit display. Use dot notation to query and set properties.

c = quantumCircuit([hGate(1); cxGate(1,2)]);
p = plot(c);
n = p.NumQubits;
p.NumQubits = 3;

Quantum Circuit

expand all

Gates in the plotted circuit or composite gate, specified as a vector of gates. The largest qubit index used in the gates must not be greater than the number of qubits in the circuit.

Example: [hGate(1) cxGate(1,2)]

Number of qubits in the circuit, specified as a positive integer scalar. The number of qubits must be greater than or equal to the largest qubit index used in the gates.

Example: 3

Block sizes to separate in the plot, specified as a vector of integers. Each element of the vector specifies the size of one block of qubits. The sum of the block sizes must equal the number of qubits in the circuit.

Example: [3 2 1]

Number of rows to wrap the circuit over, specified as a positive integer scalar. If you do not set the value of NumRows, then MATLAB® automatically determines the number of rows.

Row wrapping mode, specified as "auto" or "manual". By default, MATLAB automatically wraps rows of the quantum circuit. If you change the value of the NumRows property manually, then MATLAB changes the value of the WrappingMode property to "manual".

Location of qubit line labels, specified as "left", "right", "none", or "both". If you do not set the value of QubitLabelLocation, then MATLAB automatically determines the label locations.

Qubit line label location mode, specified as "auto" or "manual". By default, MATLAB automatically places qubit line labels. If you change the value of the QubitLabelLocation property manually, then MATLAB changes the value of the QubitLabelLocationMode property to "manual".

Labels

expand all

Title text, specified as a string array, character vector, or cell array of character vectors. If the value of Title is an array, then the elements of the array are stacked vertically and displayed as the title. Alternatively, to add a title, use the title function.

title("My Title")

Example: p.Title = "My Title";

Example: p.Title = ["My Circuit",string(datetime("now"))];

Position

expand all

Chart size and location, excluding the margins for decorations such as titles. Specify this property as a vector of the form [left bottom width height]. The values are in the units specified by the Units property.

  • left — Distance from the left edge of the parent container to the inner-left edge of the chart that excludes the margins. Typically, the parent container is a figure, panel, or tab.

  • bottom — Distance from the bottom edge of the parent container to the inner-bottom edge of the chart that excludes the margins.

  • width — Width of the chart, excluding the margins.

  • height — Height of the chart, excluding the margins.

Note

Setting this property has no effect when the parent of the chart is a TiledChartLayout object.

Chart size and location, including the margins for decorations such as titles. Specify this property as a vector of the form [left bottom width height]. The values are in the units specified by the Units property.

  • left — Distance from the left edge of the parent container to the outer-left edge of the chart that includes the margins. Typically, the parent container is a figure, panel, or tab.

  • bottom — Distance from the bottom edge of the parent container to the outer-bottom edge of the chart that includes the margins.

  • width — Width of the chart, including the margins.

  • height — Height of the chart, including the margins.

Note

Setting this property has no effect when the parent of the chart is a TiledChartLayout object.

Chart size and location, excluding the margins for decorations such as titles. Specify this property as a vector of the form [left bottom width height]. This property is equivalent to the InnerPosition property.

Note

Setting this property has no effect when the parent of the chart is a TiledChartLayout object.

Position to hold constant when adding, removing, or changing decorations, specified as one of these values:

  • "outerposition" — The OuterPosition property remains constant when you add, remove, or change decorations such as a title. If any positional adjustments are needed, MATLAB adjusts the InnerPosition property.

  • "innerposition" — The InnerPosition property remains constant when you add, remove, or change decorations such as a title. If any positional adjustments are needed, MATLAB adjusts the OuterPosition property.

Note

Setting this property has no effect when the parent of the chart is a TiledChartLayout object.

Position units, specified as a value from the following table. To change the position of the chart in specific units, set the Units property before specifying the Position property. If you specify the Units and Position properties in a single command (using name-value arguments), be sure to specify Units before Position.

UnitsDescription
"normalized" (default)Normalized with respect to the parent container, which is typically the figure, panel, or tab. The lower-left corner of the container maps to (0,0), and the upper-right corner maps to (1,1).
"inches"Inches
"centimeters"Centimeters
"characters"

Based on the default font of the graphics root object:

  • Character width = width of letter x.

  • Character height = distance between the baselines of two lines of text.

"points"Typography points. One point equals 1/72 inch.
"pixels"

Distances in pixels are independent of your system resolution on Windows® and Macintosh systems:

  • On Windows systems, a pixel is 1/96 inch.

  • On Macintosh systems, a pixel is 1/72 inch.

On Linux® systems, the size of a pixel is determined by your system resolution.

Layout options, specified as a TiledChartLayoutOptions object. This property specifies options when an instance of your chart is a child of a tiled chart layout. If the instance is not a child of a tiled chart layout (for example, it is a child of a figure or panel), then this property is empty and has no effect. Otherwise, you can position the chart within the layout by setting the Tile and TileSpan properties on the TiledChartLayoutOptions object.

For example, this code places chart object c into the third tile of a tiled chart layout.

c.Layout.Tile = 3;

To make the chart span multiple tiles, specify the TileSpan property as a two-element vector. For example, this chart spans 2 rows and 3 columns of tiles.

c.Layout.TileSpan = [2 3];

Note

Tiled chart layouts are not supported for the axes returned by the getAxes method. Instead, you can place an instance of your chart into a tiled chart layout.

Interactivity

expand all

State of visibility, specified as "on" or "off", or as numeric or logical 1 (true) or 0 (false). A value of "on" is equivalent to true, and "off" is equivalent to false. Thus, you can use the value of this property as a logical value. The value is stored as an on/off logical value of type matlab.lang.OnOffSwitchState.

  • "on" — Display the chart.

  • "off" — Hide the chart without deleting it. You still can access the properties of a chart when it is not visible.

Parent/Child

expand all

Parent container of the chart, specified as a Figure, Panel, Tab, or TiledChartLayout object.

Visibility of the chart object handle in the Children property of the parent, specified as one of these values:

  • "on" — Chart object handle is always visible.

  • "off" — Chart object handle is invisible at all times. This option is useful for preventing unintended changes to the chart by another function. To temporarily hide the handle during the execution of that function, set HandleVisibility to "off".

  • "callback" — Chart object handle is visible from within callbacks or functions invoked by callbacks, but not from within functions invoked from the command line. This option blocks access to the object in the Command Window, but it allows callback functions to access it.

If the object is not listed in the Children property of the chart's parent object, then functions that get object handles by searching the object hierarchy or querying handle properties cannot return it. Examples of such functions include get, findobj, gca, gcf, gco, newplot, cla, clf, and close.

Hidden object handles are still valid. Set the root ShowHiddenHandles property to "on" to list all object handles, regardless of their HandleVisibility property setting.

Version History

Introduced in R2023b