Skip to content

Commit 4af0ee0

Browse files
committed
modified: src/qibocal/protocols/qua/rb_single_qubit.py
1 parent aa01972 commit 4af0ee0

1 file changed

Lines changed: 23 additions & 11 deletions

File tree

src/qibocal/protocols/qua/rb_single_qubit.py

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
from typing import Optional
33

44
import matplotlib.pyplot as plt
5+
import plotly.express as px
56
import mpld3
67
import numpy as np
78
import numpy.typing as npt
@@ -614,20 +615,31 @@ def _plot(data: QuaSingleQubitRbData, target: QubitId, fit: QuaSingleQubitRbResu
614615
]
615616
)
616617

617-
fig = plt.figure(figsize=(16, 6))
618-
plt.errorbar(
619-
depths, ydata, ysigma, marker="o", linestyle="-", markersize=4, label="data"
620-
)
618+
# Plot using plotly
619+
fig = px.line(x=depths, y=ydata, error_y=ysigma, markers=True, labels={"x": "Depth", "y": "Survival probability"})
620+
fig.add_scatter(x=depths, y=ydata, mode="markers", name="data")
621+
621622
if pars is not None:
622623
max_circuit_depth = depths[-1]
623624
x = np.linspace(0, max_circuit_depth + 0.1, 1000)
624-
plt.plot(x, power_law(x, *pars), linestyle="--", label="fit")
625-
plt.xlabel("Depth")
626-
plt.ylabel("Survival probability")
627-
plt.legend()
628-
629-
figures = [mpld3.fig_to_html(fig)]
630-
return figures, fitting_report
625+
fig.add_scatter(x=x, y=power_law(x, *pars), mode="lines", name="fit")
626+
627+
fig.show()
628+
629+
# fig = plt.figure(figsize=(16, 6))
630+
# plt.errorbar(
631+
# depths, ydata, ysigma, marker="o", linestyle="-", markersize=4, label="data"
632+
# )
633+
# if pars is not None:
634+
# max_circuit_depth = depths[-1]
635+
# x = np.linspace(0, max_circuit_depth + 0.1, 1000)
636+
# plt.plot(x, power_law(x, *pars), linestyle="--", label="fit")
637+
# plt.xlabel("Depth")
638+
# plt.ylabel("Survival probability")
639+
# plt.legend()
640+
641+
#figures = [mpld3.fig_to_html(fig)]
642+
return [fig], fitting_report
631643

632644

633645
def _update(results: QuaSingleQubitRbResults, platform: Platform, target: QubitId):

0 commit comments

Comments
 (0)