From 0176b83a62fcbd46e2cce9bf8b2bc6d996d414d0 Mon Sep 17 00:00:00 2001 From: cylammarco Date: Wed, 28 Jun 2023 03:25:14 +0300 Subject: [PATCH] added labels to plot_fit in plotly mode. --- src/rascal/plotting.py | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/rascal/plotting.py b/src/rascal/plotting.py index 414e1fa..085e72e 100644 --- a/src/rascal/plotting.py +++ b/src/rascal/plotting.py @@ -737,7 +737,7 @@ def plot_fit( except Exception as e: calibrator.logger.error(e) calibrator.logger.error( - "Spectrum is not provided, it cannot be " "plotted." + "Spectrum is not provided, it cannot be plotted." ) if spectrum is not None: @@ -985,6 +985,22 @@ def plot_fit( ) ) + fig.add_annotation( + x=x, + y=text_box_pos, + xref="x", + yref="y3", + text="{}:{:1.2f}".format( + calibrator.atlas.get_elements()[idx], + calibrator.atlas.get_lines()[idx], + ), + textangle=-90, + showarrow=False, + bordercolor="#000000", + borderwidth=1, + bgcolor="#FFFFFF", + ) + x_fitted = calibrator.polyval(fitted_peaks, fit_coeff) fig.add_trace(