Skip to content

Commit

Permalink
added labels to plot_fit in plotly mode.
Browse files Browse the repository at this point in the history
  • Loading branch information
cylammarco committed Jun 28, 2023
1 parent a21192a commit 0176b83
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion src/rascal/plotting.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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(
Expand Down

0 comments on commit 0176b83

Please sign in to comment.