qiskit: drawing the schedule of an empty circuit raises warning from matplotlib

Information

  • Qiskit Terra version: master
  • Python version: 3.8
  • Operating system: MacOS

What is the current behavior?

from qiskit import schedule, QuantumCircuit, transpile
from qiskit.test.mock import FakeOpenPulse2Q

circuit = QuantumCircuit(1)

schedule(circuit, FakeOpenPulse2Q()).draw()
.../qiskit-terra/qiskit/visualization/pulse_v2/plotters/matplotlib.py:160: UserWarning: Attempting to set identical left == right == 0.0 results in singular transformations; automatically expanding.
  self.ax.set_xlim(*axis_config.window)
.../qiskit-terra/venv/lib/python3.8/site-packages/matplotlib/tight_bbox.py:71: RuntimeWarning: divide by zero encountered in double_scalars
  fig.patch.set_bounds(x0 / w1, y0 / h1,
.../qiskit-terra/venv/lib/python3.8/site-packages/matplotlib/tight_bbox.py:72: RuntimeWarning: divide by zero encountered in double_scalars
  fig.bbox.width / w1, fig.bbox.height / h1)
.../qiskit-terra/venv/lib/python3.8/site-packages/matplotlib/patches.py:769: RuntimeWarning: invalid value encountered in double_scalars
  y1 = self.convert_yunits(self._y0 + self._height)
.../venv/lib/python3.8/site-packages/matplotlib/transforms.py:2013: RuntimeWarning: invalid value encountered in double_scalars
  self._mtx[1, 2] += ty

What is the expected behavior?

I think the actual output drawing is correct. image

However, I dont think these warnings are useful and they should be removed.

Suggested solutions

I think giving some dummy values is probably the cleanest way to remove these obscure warnings.

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 19 (10 by maintainers)

Most upvoted comments

Hi @scapape it seems that @Atri22 is unresponsive so I will reassign to you. Let us know if you have any questions 😄