@@ -335,15 +335,31 @@ def pick_color(trace_key: str, group_key: str | None = None):
335335 a2 ['font' ]['size' ] = font_size
336336 anns .append (a2 )
337337
338- fig .update_xaxes (autorange = "reversed" ,
339- title = "<b>δ <sup>1</sup>H<b>" , title_font = dict (size = font_size * 1.5 ),
340- tickfont = dict (size = max (font_size - 2 , 8 )),
341- showgrid = True , gridcolor = "rgba(0,0,0,0.05)" , zeroline = False )
342- fig .update_yaxes (title = "<b>Intensity</b>" , title_font = dict (size = font_size ),
343- tickfont = dict (size = max (font_size - 2 , 8 )),
344- showgrid = True , gridcolor = "rgba(0,0,0,0.05)" , zeroline = False )
338+ fig .update_xaxes (
339+ autorange = "reversed" ,
340+ title = dict (
341+ text = "<b>δ <sup>1</sup>H</b>" ,
342+ font = dict (size = int (font_size * 1.5 ))
343+ ),
344+ tickfont = dict (size = max (font_size - 2 , 8 )),
345+ showgrid = True ,
346+ gridcolor = "rgba(0,0,0,0.05)" ,
347+ zeroline = False
348+ )
349+
350+ fig .update_yaxes (
351+ title = dict (
352+ text = "<b>Intensity</b>" ,
353+ font = dict (size = int (font_size * 1.5 ))
354+ ),
355+ tickfont = dict (size = max (font_size - 2 , 8 )),
356+ showgrid = True ,
357+ gridcolor = "rgba(0,0,0,0.05)" ,
358+ zeroline = False
359+ )
345360
346361 fig .update_layout (
362+ uirevision = "constant" ,
347363 template = "plotly_white" ,
348364 annotations = anns ,
349365 autosize = True ,
@@ -371,15 +387,22 @@ def pick_color(trace_key: str, group_key: str | None = None):
371387 showline = True , # enable axis line
372388 linecolor = "black" , # axis line color
373389 linewidth = 2 , # axis line width
374- mirror = False # show line on both bottom & top
390+ mirror = False , # show line only on bottom
391+ title = dict (
392+ text = "<b>δ <sup>1</sup>H</b>" ,
393+ font = dict (size = int (font_size * 1.5 ), color = "black" )
394+ ),
395+ tickfont = dict (size = max (font_size - 2 , 9 ), color = "black" )
375396 ),
376397 yaxis = dict (
377398 showline = True ,
378399 linecolor = "black" ,
379400 linewidth = 2 ,
380- mirror = False ,
381- title = "<b>Intensity</b>" ,
382- titlefont = dict (size = font_size * 1.5 , color = "black" ),
401+ mirror = False , # show line only on left
402+ title = dict (
403+ text = "<b>Intensity</b>" ,
404+ font = dict (size = int (font_size * 1.5 ), color = "black" )
405+ ),
383406 tickfont = dict (size = max (font_size - 2 , 9 ), color = "black" ),
384407 exponentformat = "power" , # use 10^n style
385408 showexponent = "all"
@@ -578,5 +601,5 @@ def run(self, debug=True, port=8050):
578601 df = pd .read_csv ('https://raw.githubusercontent.com/aeiwz/example_data/main/dataset/Example_NMR_data.csv' )
579602 spectra = df .iloc [:, 1 :]
580603 label = df ['Group' ]
581- annotator = annotate_peak (meta = label , spectra = spectra , label = label , colour_dict = { "A" : "green" } )
604+ annotator = annotate_peak (meta = label , spectra = spectra , label = label )
582605 annotator .run (debug = True , port = 8052 )
0 commit comments