diff --git a/qiskit_experiments/curve_analysis/curve_analysis.py b/qiskit_experiments/curve_analysis/curve_analysis.py index 8994995e95..a824702889 100644 --- a/qiskit_experiments/curve_analysis/curve_analysis.py +++ b/qiskit_experiments/curve_analysis/curve_analysis.py @@ -174,10 +174,11 @@ def _run_analysis( formatted_data = self._format_data(processed_data) if self.options.plot: for s in self.__series__: + sub_data = formatted_data.get_subset_of(s.name) self.drawer.draw_formatted_data( - x_data=formatted_data.x, - y_data=formatted_data.y, - y_err_data=formatted_data.y_err, + x_data=sub_data.x, + y_data=sub_data.y, + y_err_data=sub_data.y_err, name=s.name, ax_index=s.canvas, color=s.plot_color, @@ -244,13 +245,14 @@ def _run_analysis( alpha=alpha, color=s.plot_color, ) - # Write fitting report - report_description = "" - for res in analysis_results: - if isinstance(res.value, (float, UFloat)): - report_description += f"{analysis_result_to_repr(res)}\n" - report_description += r"Fit $\chi^2$ = " + f"{fit_data.reduced_chisq: .4g}" - self.drawer.draw_fit_report(description=report_description) + + # Write fitting report + report_description = "" + for res in analysis_results: + if isinstance(res.value, (float, UFloat)): + report_description += f"{analysis_result_to_repr(res)}\n" + report_description += r"Fit $\chi^2$ = " + f"{fit_data.reduced_chisq: .4g}" + self.drawer.draw_fit_report(description=report_description) # Add raw data points analysis_results.extend(self._create_curve_data(formatted_data, self.__series__)) diff --git a/releasenotes/notes/fix-multi-series-plot-ac5ff39cabf5d578.yaml b/releasenotes/notes/fix-multi-series-plot-ac5ff39cabf5d578.yaml new file mode 100644 index 0000000000..6d3599e9a5 --- /dev/null +++ b/releasenotes/notes/fix-multi-series-plot-ac5ff39cabf5d578.yaml @@ -0,0 +1,6 @@ +--- +fixes: + - | + Fix broken curve analysis output figure when multi canvas mode is enabled. + Currently this feature is only used by :class:`.CrossResonanceHamiltonianAnalysis`. + It has been plotting all series data in the same canvas due to the bug.