Socket
Socket
Sign inDemoInstall

matplotnode

Package Overview
Dependencies
0
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    matplotnode

C++ bindings for Node.js exposing a subset of matplotlib's functionality through the CPython API.


Version published
Weekly downloads
48
increased by17.07%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

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

  • plot([x], y, ...kwargs)*
  • subplot(str)
  • show()
  • legend()
  • grid(bool active)
  • save(filename)
  • xlim(from, to)
  • ylim(from, to)
  • title(name)
  • axis(axis)
  • xlabel(name)
  • ylabel(name)
  • clf()
  • cla()
  • close()
  • 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");

subplot example

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();

show example

Keywords

FAQs

Last updated on 30 Jul 2019

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc