funcnodes-span 0.3.2__tar.gz → 0.3.4__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.3
2
2
  Name: funcnodes-span
3
- Version: 0.3.2
3
+ Version: 0.3.4
4
4
  Summary: SPectral ANalysis (SPAN) for funcnodes
5
5
  License: MIT
6
6
  Author: Kourosh Rezaei
@@ -7,7 +7,7 @@ from .baseline import BASELINE_NODE_SHELF as BASELINE
7
7
  from funcnodes_lmfit import NODE_SHELF as LMFIT_NODE_SHELF
8
8
  from .curves import CURVES_NODE_SHELF
9
9
 
10
- __version__ = "0.3.2"
10
+ __version__ = "0.3.4"
11
11
 
12
12
  NODE_SHELF = fn.Shelf(
13
13
  name="Spectral Analysis",
@@ -329,7 +329,16 @@ def force_peak_finder(
329
329
  default_render_options={"data": {"src": "figure"}},
330
330
  outputs=[{"name": "figure"}],
331
331
  )
332
- def plot_peaks(x: np.array, y: np.array, peaks: List[PeakProperties]) -> go.Figure:
332
+ def plot_peaks(
333
+ x: np.array,
334
+ y: np.array,
335
+ peaks: List[PeakProperties],
336
+ fill_rectangles: bool = True,
337
+ xaxis_title: str = "x",
338
+ yaxis_title: str = "y",
339
+ title: str = "",
340
+ show_legend: bool = True,
341
+ ) -> go.Figure:
333
342
  fig = go.Figure()
334
343
 
335
344
  # Set up line plot
@@ -353,16 +362,19 @@ def plot_peaks(x: np.array, y: np.array, peaks: List[PeakProperties]) -> go.Figu
353
362
  peak.x_at_f_index,
354
363
  peak.x_at_f_index,
355
364
  peak.x_at_i_index,
365
+ peak.x_at_i_index,
356
366
  ],
357
- y=[plot_y_min, plot_y_min, peak_height, peak_height],
358
- fill="toself",
359
- fillcolor=peaks_colors[index % len(peaks_colors)],
360
- opacity=0.3,
361
- line=dict(width=0),
367
+ y=[plot_y_min, plot_y_min, peak_height, peak_height, plot_y_min],
368
+ fill="toself" if fill_rectangles else None,
369
+ fillcolor=peaks_colors[index % len(peaks_colors)]
370
+ if fill_rectangles
371
+ else None,
372
+ opacity=0.3 if fill_rectangles else 1,
373
+ line=dict(width=0 if fill_rectangles else 2),
362
374
  mode="lines",
363
375
  name=f"Peak {peak.id}",
364
376
  legendgroup=f"Peak {peak.id}", # Group by Peak id
365
- showlegend=True,
377
+ showlegend=show_legend,
366
378
  )
367
379
  )
368
380
  # Add an X marker at the exact peak position
@@ -390,14 +402,21 @@ def plot_peaks(x: np.array, y: np.array, peaks: List[PeakProperties]) -> go.Figu
390
402
  dash="dash", color=peaks_colors[index % len(peaks_colors)]
391
403
  ),
392
404
  legendgroup=f"Peak {peak.id}",
405
+ showlegend=show_legend,
393
406
  ),
394
407
  )
395
408
 
396
409
  # Customize layout (axes labels and title can be added here if needed)
397
410
  fig.update_layout(
398
- xaxis_title="x",
399
- yaxis_title="y",
400
- template="plotly_white",
411
+ xaxis_title=xaxis_title,
412
+ yaxis_title=yaxis_title,
413
+ title=title,
414
+ plot_bgcolor="white",
415
+ paper_bgcolor="white",
416
+ showlegend=show_legend,
417
+ font=dict(family="Arial", size=14),
418
+ xaxis=dict(title_font=dict(size=16), tickfont=dict(size=14)),
419
+ # yaxis=dict(title_font=dict(size=16), tickfont=dict(size=14), tickformat=".2e"),
401
420
  )
402
421
 
403
422
  return fig
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "funcnodes-span"
3
- version = "0.3.2"
3
+ version = "0.3.4"
4
4
  description = "SPectral ANalysis (SPAN) for funcnodes"
5
5
  authors = ["Kourosh Rezaei <kouroshrezaei90@gmail.com>"]
6
6
  readme = "README.md"
File without changes
File without changes