Matplotnode
C++ bindings for Node.js exposing a subset of matplotlib's functionality through the CPython API.
Install / Use
/learn @mateogianolio/MatplotnodeREADME
matplotnode
C++ bindings for Node.js exposing a subset of matplotlib's functionality through the CPython API. Inspired by matplotlib-cpp by lava. Useful for scientific plotting.
Requirements
- Python 2.7 (might work on Python 3, not tested yet)
- matplotlib
Usage
$ npm install matplotnode
const plt = require('matplotnode');
Bindings
- [x]
plot([x], y, ...kwargs)* - [x]
subplot(str) - [x]
show() - [x]
legend() - [x]
grid(bool active) - [x]
save(filename) - [x]
xlim(from, to) - [x]
ylim(from, to) - [x]
title(name) - [x]
axis(axis) - [x]
xlabel(name) - [x]
ylabel(name) - [x]
clf() - [x]
cla() - [x]
close() - [x]
xkcd()
*See how kwargs are implemented in test.js
Example
const plt = require('matplotnode');
const x = new Array(100).fill(0).map((x, i) => i / Math.PI);
// xkcd-style plot :)
plt.xkcd();
plt.subplot("211");
plt.title('trig');
plt.plot(x, x.map(Math.sin), 'color=r', 'label=sin(x)');
plt.plot(x, x.map(Math.cos), 'color=g', 'label=cos(x)');
plt.legend();
plt.subplot("212");
plt.plot(x, x.map(Math.sin).map((t, i) => t * i), 'color=b', 'label=x * sin(x)', 'marker=o', 'linestyle=None');
plt.legend();
plt.ylim(-100, 100);
plt.save("./examples/subplot.png");

const plt = require('matplotnode');
const x = new Array(100).fill(0).map((x, i) => i / Math.PI);
plt.plot(x, x.map(Math.sin));
plt.grid(true);
plt.show();

Related Skills
node-connect
349.2kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
109.5kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
349.2kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
349.2kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
