Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Stable] Finish deprecation for line_length and fold in style dict #3200

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion qiskit/circuit/quantumcircuit.py
Original file line number Diff line number Diff line change
Expand Up @@ -605,11 +605,13 @@ def draw(self, scale=0.7, filename=None, style=None, output=None,
with_layout (bool): Include layout information, with labels on the physical
layout. Default is True.
fold (int): Sets pagination. It can be disabled using -1.
In `text`, sets the length of the lines. This useful when the
In `text`, sets the length of the lines. This is useful when the
drawing does not fit in the console. If None (default), it will try to
guess the console width using `shutil.get_terminal_size()`. However, if
running in jupyter, the default line length is set to 80 characters.
In `mpl` is the amount of operations before folding. Default is 25.
This option will be ignored with the ``latex`` and
``latex_source`` backends.
Returns:
PIL.Image or matplotlib.figure or str or TextDrawing:
* PIL.Image: (output `latex`) an in-memory representation of the
Expand Down
3 changes: 3 additions & 0 deletions qiskit/visualization/circuit_visualization.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,9 @@ def circuit_drawer(circuit,
guess the console width using `shutil.get_terminal_size()`. However, if
running in jupyter, the default line length is set to 80 characters.
In `mpl` is the amount of operations before folding. Default is 25.
This option will be ignored with the ``latex`` and ``latex_source``
backends.

Returns:
PIL.Image: (output `latex`) an in-memory representation of the image
of the circuit diagram.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
deprecations:
- |
The ``line length`` kwarg for the ``qiskit.QuantumCircuit.draw()`` method
and the ``qiskit.visualization.circuit_drawer()`` function with the text
output mode is deprecated. It has been replaced by the ``fold`` kwarg which
will behave identically for the text output mode (but also now supports
the mpl output mode too). ``line_length`` will be removed in a future
release so calls should be updated to use ``fold`` instead.
- |
The ``fold`` field in the ``style`` dict kwarg for the
``qiskit.QuantumCircuit.draw()`` method and the
``qiskit.visualization.circuit_drawer()`` function has been deprecated. It
has been replaced by the ``fold`` kwarg on both functions. This kwarg
behaves identically to the field in the style dict.