Metadata-Version: 2.4
Name: qplot-cli
Version: 0.3.0
Summary: Quick inspection and plotting of scientific tabular data
License-Expression: MIT
Project-URL: Homepage, https://github.com/Al3xPhys/qplot-cli
Project-URL: Repository, https://github.com/Al3xPhys/qplot-cli
Project-URL: Issues, https://github.com/Al3xPhys/qplot-cli/issues
Keywords: cli,plotting,scientific-data,csv,matplotlib
Classifier: Development Status :: 3 - Alpha
Classifier: Environment :: Console
Classifier: Intended Audience :: Science/Research
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Topic :: Scientific/Engineering :: Visualization
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: typer>=0.12
Requires-Dist: pandas>=2.0
Requires-Dist: numpy>=1.24
Requires-Dist: matplotlib>=3.7
Provides-Extra: test
Requires-Dist: pytest>=8.0; extra == "test"
Provides-Extra: dev
Requires-Dist: build>=1.2; extra == "dev"
Requires-Dist: pytest>=8.0; extra == "dev"
Requires-Dist: twine>=6.0; extra == "dev"
Dynamic: license-file

# qplot

[![PyPI version](https://img.shields.io/pypi/v/qplot-cli.svg)](https://pypi.org/project/qplot-cli/)
[![Python versions](https://img.shields.io/pypi/pyversions/qplot-cli.svg)](https://pypi.org/project/qplot-cli/)
[![CI](https://github.com/Al3xPhys/qplot-cli/actions/workflows/ci.yml/badge.svg)](https://github.com/Al3xPhys/qplot-cli/actions/workflows/ci.yml)

`qplot` is a command-line tool for quickly inspecting and plotting ordinary
scientific CSV, TSV, TXT, and DAT files. It detects delimiters and headers,
explains its x/y inference, supports explicit column overrides, and can show a
plot interactively or save it without a GUI.

> **Alpha status:** qplot is usable, but its interface and automatic inference
> may change before the first stable release.

## Installation

Python 3.10 or newer is required. The distribution is named `qplot-cli`, while
the command it installs is `qplot`.

The recommended installation for command-line use is
[pipx](https://pipx.pypa.io/):

```bash
pipx install qplot-cli
```

Alternatively, install it into the current Python environment:

```bash
python -m pip install qplot-cli
```

Confirm the command is available:

```bash
qplot --version
qplot --help
```

If Windows cannot find `qplot` after installation, use `python -m qplot` or
ensure the Python Scripts directory reported by `python -m site --user-base` is
on `PATH`.

## Quick start

Inspect a file without plotting:

```bash
qplot data.csv --columns
qplot data.csv --info
```

Infer columns and open an interactive plot:

```bash
qplot data.csv
```

Save a plot on a desktop, server, or CI runner without opening a window:

```bash
qplot data.csv --no-gui --save plot.png
```

Select columns by exact case-insensitive name or zero-based index:

```bash
qplot measurements.tsv -x time -y voltage -y temperature
qplot measurements.tsv -x 0 -y 1 -y 2
```

Apply plotting and loading overrides:

```bash
qplot data.csv --scatter --logx --logy --title "Field sweep"
qplot data.txt --delimiter ";" --header 2 --rows 100:500
qplot headerless.dat --no-header --all
qplot legacy-export.csv --encoding cp1252 --info
qplot data.csv --missing-y error
qplot instrument.csv --invalid-y error
```

`--rows START:STOP` uses zero-based, stop-exclusive slicing. `--all` plots all
numeric y columns remaining after x selection. Run `qplot --help` for every
option.

Text input defaults to `utf-8-sig`, which supports ordinary UTF-8 and UTF-8
files with a byte-order mark. Use `--encoding` for files produced with another
encoding, such as `cp1252` or `latin-1`.

Empty cells and the case-insensitive markers `NA`, `N/A`, `NaN`, and `null`
are interpreted as missing values. By default, missing y values produce visible
gaps in line plots and omitted markers in scatter plots, and qplot prints a
warning for every affected y column. Use `--missing-y drop` to connect across
missing points or `--missing-y error` to reject them. Missing x values are
always rejected because they affect every plotted series. Unrecognised tokens
such as `ERROR` are not silently treated as missing data. A mixed column is
eligible for automatic y inference when at least half of its non-missing values
are numeric; it is never considered as an automatic x column. Invalid y values
produce gaps by default, with warnings that identify their row positions and
tokens. Line plots containing gaps show point markers so isolated valid
measurements remain visible at their true x positions. Use `--invalid-y drop`
to remove those points or `--invalid-y error` for strict validation. Mixed
columns below the 50% threshold remain excluded and are explained by `--info`;
they can still be selected explicitly with `-y`.

## Automatic behaviour

The loader samples the file to detect comma, tab, semicolon, or space
separators and whether a header is present. Inference deterministically scores
x candidates using recognised names, monotonicity, uniqueness, and spacing. Y
candidates use recognised response names and variation. Automatic plots include
at most three y traces; `--all` removes that limit.

## Platform notes

Headless plotting uses Matplotlib's `Agg` backend and does not require a display
server. Interactive plotting uses a GUI backend available on the host system.
Windows Python installations commonly include Tk support; some Linux systems
need an additional package such as `python3-tk`. If interactive plotting is not
available, use `--no-gui --save OUTPUT.png`.

Windows and Ubuntu are tested in continuous integration on Python 3.10, 3.12,
and 3.14. Other Python versions from 3.10 onward are expected to work but are
not included in the current CI matrix.

## Development

Clone the repository and install it in editable mode with development tools:

```bash
python -m pip install -e ".[dev]"
python -m pytest
```

CI runs the test suite on Windows and Ubuntu and builds both a wheel and source
distribution. See [CONTRIBUTING.md](CONTRIBUTING.md) before proposing a larger
change.

## Current limitations

- One input file is supported per invocation.
- Files are loaded eagerly into memory; text encoding defaults to `utf-8-sig`
  and can be overridden explicitly.
- Detection supports ordinary delimited tables and leading blank or comment
  lines; arbitrary instrument metadata and concatenated tables are not yet
  interpreted.
- Interactive plotting depends on a working local Matplotlib GUI backend.
- HDF5, Excel, NumPy, Qt, fitting, smoothing, presets, arbitrary expressions,
  and plugins are intentionally outside this alpha.

## Licence

qplot is released under the [MIT License](LICENSE).
