Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
277259b
New draft for new version
carlosbornes Nov 3, 2025
7a9c1df
Moved dmfit grid plots to the correct place
carlosbornes Nov 3, 2025
a438f60
Bump version
MSoares98 Jan 21, 2026
1dadc9b
Fixed dmfit1d_grid. Still WIP
MSoares98 Jan 21, 2026
0de4d33
Implemented several fixes from #29
carlosbornes Jan 30, 2026
93167fd
Fix ruff problems and test
carlosbornes Jan 30, 2026
e1c572b
Ruff reformatting
carlosbornes Jan 30, 2026
9419151
Fixed deconv_color for multiple spectra, #29
MSoares98 Feb 4, 2026
459094b
Improve consistency and refactoring for v0.2.2
carlosbornes Feb 5, 2026
aff630c
Merge remote: combine deconv_color per-line support with multi-spectr…
carlosbornes Feb 5, 2026
ffb04ef
Fix problems with ruff
carlosbornes Feb 5, 2026
7d9bc95
More ruff formatting
carlosbornes Feb 5, 2026
a60656e
Added citation.cff #31 and updated README.md
carlosbornes Feb 6, 2026
f6d3c5b
Update changelog
carlosbornes Feb 6, 2026
a1b399c
Fix deconv_color handling in dmfit1d_grid
carlosbornes Mar 10, 2026
a3fc6fa
Move cmap/color validation before if/elif chain in bruker2
carlosbornes Mar 10, 2026
405dfca
Fix doc errors
carlosbornes Mar 10, 2026
e069e27
Fix some x and ylabels on plot.py and updated proj dependencies
carlosbornes Mar 10, 2026
8dd3d4a
Try different fix
carlosbornes Mar 10, 2026
49f35e5
Update actions checkouts
carlosbornes Mar 10, 2026
ab420a0
Another attempt at fixing docs
carlosbornes Mar 10, 2026
2a9fc20
Add doc still to cli function
carlosbornes Mar 10, 2026
a501066
Update src/spinplots/io.py
carlosbornes Mar 10, 2026
b766c26
Apply suggestions from code review
carlosbornes Mar 10, 2026
15dc305
Fix tag and label handling SpinCollection
carlosbornes Mar 10, 2026
582a6bb
Fix tag handling for tests
carlosbornes Mar 11, 2026
bcb4347
Update color indexing and uv.lck
carlosbornes Mar 11, 2026
28f529b
Update log for new release
carlosbornes Mar 11, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:

steps:
- name: Check out repo
uses: actions/checkout@v5
uses: actions/checkout@v6
with:
fetch-depth: 0

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
permissions:
id-token: write
steps:
- uses: actions/checkout@v5
- uses: actions/checkout@v6

- uses: actions/setup-python@v6
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:

steps:
- name: Check out repo
uses: actions/checkout@v5
uses: actions/checkout@v6

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v6
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ dmypy.json

# Editors ignores
.vscode*
.claude/

# Environments
.env
Expand Down
37 changes: 37 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,43 @@ All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.2.2]

### Added
- **Grid layouts for missing plot types**: `bruker2d_grid`, `dmfit1d_grid`, `dmfit2d_grid`
- **Stacked plots**: Support for stacking multiple 1D spectra (Bruker and DMFit)
- **Per-line deconvolution colors**: `deconv_color` accepts a list of colors for individual DMFit deconvolution lines
- **Per-subplot limits**: `xlim` and `ylim` accept list of tuples for per-subplot control in grid functions
- **Tag filtering**: `SpinCollection.plot(filter=...)` to plot a subset of spectra
- **Unknown kwarg warnings**: Plot functions now warn on unrecognized keyword arguments instead of silently ignoring them
- **Citation file**: Added `CITATION.cff` for standardized citation metadata (#31)
- **Default tags**: `SpinCollection.append()` auto-generates tags (`Spin0`, `Spin1`, ...) when none provided

### Changed
- **API consistency**: Renamed parameters for consistency across all plot functions:
- `colors` → `color`, `proj_colors` → `proj_color`
- `homo` → `homonuclear`, `diag` → `diagonal`
- `labels` → `titles` in `dmfit1d_grid` (for subplot titles)
- **Unified input types**: All plot functions now accept spectrum dicts; `Spin.plot()` handles extraction
- **Standardized save logic**: All functions use consistent defaults (PNG format, dpi=300)
- **Projection keys**: Standardized to `f1`/`f2` across Bruker and DMFit 2D plots
- **SpinCollection.tag setter**: Now disallows `None` and syncs the internal dict key

### Fixed
- `read_nmr()` now accepts `tags="string"` for single paths (no longer requires a list)
- `__init__.py` exports all public plot functions
- `dmfit1d` now uses global DEFAULTS dict like other functions
- Extracted shared helpers to reduce code duplication in `plot.py`
- Color list indexing: `color` and `deconv_color` now use modulo indexing to cycle colors when fewer are provided than spectra or deconvolution lines
- Unreachable `elif` in `bruker2d`: moved `cmap`/`color` validation before the conditional chain
- Grid plots now correctly route `SpinCollection` tags to subplot `titles` instead of legend `labels`
- **Docs**: Fixed `mkdocstrings-python` 2.x configuration and excluded internal `_helpers` from reference docs

## [0.2.1]

### Fixed
- Fixed plotting of Bruker homonuclear spectra acquired without CP (cross-polarization). Reported by Andrej Šmelko (#25, #26)

## [0.2.0]

### Added
Expand Down
49 changes: 49 additions & 0 deletions CITATION.cff
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
cff-version: 1.2.0
title: SpinPlots
message: >-
If you use this software, please cite it using the
metadata from this file.
type: software
authors:
- given-names: Carlos
family-names: Bornes
affiliation: >-
Department of Physical and Macromolecular Chemistry,
Faculty of Science, Charles University in Prague, 128
43, Prague, Czech Republic
orcid: 'https://orcid.org/0000-0002-0325-2356'
- given-names: Daniel
family-names: Pereira
affiliation: >-
Department of Chemistry & CICECO−Aveiro Institute of
Materials, University of Aveiro, 3810-193, Aveiro,
Portugal
orcid: 'https://orcid.org/0000-0001-7329-2516'
- given-names: Márcio
family-names: Soares
affiliation: >-
Department of Chemistry & CICECO−Aveiro Institute of
Materials, University of Aveiro, 3810-193, Aveiro,
Portugal
orcid: 'https://orcid.org/0000-0001-8012-2662'
identifiers:
- type: doi
value: 10.5281/zenodo.14041925
repository-code: 'https://github.com/nuts-org/spinplots'
url: 'https://nuts-org.github.io/spinplots/'
abstract: >-
SpinPlots simplifies NMR spectroscopy visualization in
Python. It provides one-line plotting for 1D and 2D Bruker
and DMFit spectra with automatic axis labelling,
publication-ready defaults, and support for overlays,
stacking, and grid layouts.
keywords:
- NMR
- spectroscopy
- visualization
- Bruker
- DMFit
- Python
license: MIT
version: v0.2.2
date-released: '2025-02-06'
35 changes: 26 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,34 @@

[![DOI](https://zenodo.org/badge/782205685.svg)](https://doi.org/10.5281/zenodo.14041925)

SpinPlots is a Python package designed to streamline the process of loading and plotting NMR data. Built on top of the [NMRglue](https://www.nmrglue.com/), SpinPlots simplifies the plotting of NMR spectra. While NMRglue is a powerful tool for reading, processing, and analyzing NMR data, plotting with it can be cumbersome and code-intensive. SpinPlots addresses this by offering an intuitive interface for generating publication-ready plots with minimal effort.
SpinPlots is a Python package designed to streamline the process of loading and plotting NMR data. Built on top of [NMRglue](https://www.nmrglue.com/), SpinPlots simplifies the plotting of NMR spectra. While NMRglue is a powerful tool for reading, processing, and analyzing NMR data, plotting with it can be cumbersome and code-intensive. SpinPlots addresses this by offering an intuitive interface for generating publication-ready plots with minimal effort.

## Current features 🤌
- **One line of code == NMR spectrum**: Generate 1D and 2D Bruker NMR plots with a single function call.
- **Automatic labeling**: Axis are automatically labeled with the corresponding nuclei and units.
- **Customizable**: Fine-tune the look of your plots by loading them with Spinplots.
## Quick Start

```python
from spinplots import read_nmr

# Plot a 1D spectrum
read_nmr("path/to/bruker/pdata/1").plot()

# Plot a 2D spectrum with projections
read_nmr("path/to/2d/pdata/1").plot(contour_start=1e5)
```

## Features 🤌

- **One line plotting**: Generate 1D and 2D NMR plots with a single function call
- **Multiple formats**: Support for Bruker and DMFit data
- **Automatic labeling**: Axes labeled with nuclei and units
- **Overlays and stacking**: Compare multiple spectra on one plot
- **Grid layouts**: Plot multiple spectra in customizable grid arrangements
- **2D projections**: Automatic F1/F2 projections for 2D spectra
- **Publication-ready**: Customizable styling with sensible defaults

## Documentation 📖

Complete documentation for SpinPlots, including installation instructions and usage guides can be found [here](https://nuts-org.github.io/spinplots/).
Complete documentation, including installation instructions and usage guides, can be found [here](https://nuts-org.github.io/spinplots/).

## Contributing

## Future features 🔜
- Extend support to non-Bruker spectra
- Open to suggestions
Open to suggestions and contributions! Feel free to open an issue or pull request.
Loading