node-gnuplot is a lightweight wrapper for the `gnuplot` command-line utility, designed for Node.js environments. Currently at version 0.3.1, this package provides a direct and programmatic interface to interact with the external `gnuplot` plotting engine. It allows developers to send `gnuplot` commands, such as `set`, `plot`, and `splot`, via a fluent, chainable API or by piping data streams directly. The library spawns a `gnuplot` child process and manages its stdin/stdout, making it suitable for generating image files (e.g., PNG, SVG) from mathematical functions or data streams. Its release cadence is slow, and the package appears to be in an abandoned state given its low version number and lack of recent activity. A key differentiator is its minimal abstraction over `gnuplot`, providing direct access to its capabilities rather than implementing its own charting logic. Users must have `gnuplot` installed on their system for this package to function.
npm install gnuplotVerified import paths — ran on the pinned version, not inferred.
Demonstrates generating a PNG plot with chained commands and initiating a gnuplot process.
Install gnuplot on your operating system (e.g., `brew install gnuplot` on macOS, `sudo apt-get install gnuplot` on Debian/Ubuntu).
Use `const gnuplot = require('gnuplot');` to import the module in CommonJS environments. For ESM projects, you might need a wrapper or a CommonJS compatibility layer.Evaluate alternatives if long-term maintenance, active support, or compatibility with modern Node.js features are critical for your project.
Create a `gnuplot.d.ts` file with basic type definitions, or install `@types/gnuplot` if one becomes available (unlikely for an unmaintained package).
Ensure gnuplot is installed on your system and its executable path is included in your environment's PATH variable.
This package is CommonJS-only. If running in an ESM environment, you may need to wrap its usage in a CommonJS context or use dynamic `import()` for compatibility if supported by your runtime (e.g., `const gnuplot = await import('gnuplot').then(m => m.default || m);`).Ensure all commands are sent before the stream is closed. If chaining, avoid calling `.end()` prematurely or setting `{end: true}` on intermediate commands.No dependency data recorded yet.