Qiskit-Extensions / qiskit-experiments

Qiskit Experiments
https://qiskit-extensions.github.io/qiskit-experiments/
Apache License 2.0
151 stars 122 forks source link

Figures not shown in Quantum Volume tutorial #855

Closed Guillermo-Mijares-Vilarino closed 1 year ago

Guillermo-Mijares-Vilarino commented 1 year ago

Informations

What is the current behavior?

The Figure objects in the Quantum Volume tutorial are not shown properly.

Steps to reproduce the problem

Run this code (from the tutorial) with Jupyter:

from qiskit_experiments.library import QuantumVolume
from qiskit import Aer
from qiskit.providers.aer import AerSimulator

# For simulation
from qiskit.test.mock import FakeSydney

backend = AerSimulator.from_backend(FakeSydney())

qubits = tuple(range(4)) # Can use specific qubits. for example [2, 4, 7, 10]

qv_exp = QuantumVolume(qubits, seed=42)
# Transpile options like optimization_level affect only the real device run and not the simulation run
# Run options affect both simulation and real device runs
qv_exp.set_transpile_options(optimization_level=3)

# Run experiment
expdata = qv_exp.run(backend).block_for_results()

# View result data
display(expdata.figure(0))

What is the expected behavior?

Actual plots with the results of the experiments should appear instead of only Figure instances like <Figure size 640x480 with 1 Axes>.

Suggested solutions

Adding %matplotlib inline somewhere before the figures.

coruscating commented 1 year ago

This has been fixed by #814 and docs are produced correctly now in local tutorial builds. The online docs will be refreshed with the next package release.

HuangJunye commented 1 year ago

@coruscating Can the online doc show the latest version instead of the stable?

coruscating commented 1 year ago

@HuangJunye The problem with showing the latest version is that the tutorials are meant for the latest stable release, not the lastest main branch. If we do push the latest version, it may have syntax that's incompatible with the stable release and cause confusion. We are planning on updating the new online docs this week and will be more careful in the future that docs for a new release are fully functional.

HuangJunye commented 1 year ago

@coruscating Perhaps this kind of documentation changes can be backported if the they work with the stable version. I think Terra does that.