funcnodes-span 0.3.2__tar.gz → 0.3.3__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.3
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.3"
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
@@ -355,14 +364,16 @@ def plot_peaks(x: np.array, y: np.array, peaks: List[PeakProperties]) -> go.Figu
355
364
  peak.x_at_i_index,
356
365
  ],
357
366
  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
+ fill="toself" if fill_rectangles else None,
368
+ fillcolor=peaks_colors[index % len(peaks_colors)]
369
+ if fill_rectangles
370
+ else None,
371
+ opacity=0.3 if fill_rectangles else 1,
372
+ line=dict(width=0 if fill_rectangles else 2),
362
373
  mode="lines",
363
374
  name=f"Peak {peak.id}",
364
375
  legendgroup=f"Peak {peak.id}", # Group by Peak id
365
- showlegend=True,
376
+ showlegend=show_legend,
366
377
  )
367
378
  )
368
379
  # Add an X marker at the exact peak position
@@ -390,14 +401,18 @@ def plot_peaks(x: np.array, y: np.array, peaks: List[PeakProperties]) -> go.Figu
390
401
  dash="dash", color=peaks_colors[index % len(peaks_colors)]
391
402
  ),
392
403
  legendgroup=f"Peak {peak.id}",
404
+ showlegend=show_legend,
393
405
  ),
394
406
  )
395
407
 
396
408
  # Customize layout (axes labels and title can be added here if needed)
397
409
  fig.update_layout(
398
- xaxis_title="x",
399
- yaxis_title="y",
400
- template="plotly_white",
410
+ xaxis_title=xaxis_title,
411
+ yaxis_title=yaxis_title,
412
+ title=title,
413
+ plot_bgcolor="white",
414
+ paper_bgcolor="white",
415
+ showlegend=show_legend,
401
416
  )
402
417
 
403
418
  return fig
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "funcnodes-span"
3
- version = "0.3.2"
3
+ version = "0.3.3"
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