matplotlib-d 0.1.1

A simple interface to pyplot.


To use this package, run the following command in your project's root directory:

Manual usage
Put the following dependency into your project's dependences section:

matplotlib-d

MIT License Build Status Dub version

A simple interface to pyplot for D.

Requirements

  • Python
  • matplotlib

Build

$ cd matplotlib-d
$ dub build --build=release

Usage

To use this package, put the following dependency into your project's dependencies section: dub.json: "matplotlib-d": "~>0.1.0" dub.sdl: dependency "matplotlib-d" version="~>0.1.0"

Simple example:

import std.math;
import std.range;
import std.algorithm;
import plt = matplotlibd.pyplot;

void main() {
	auto x = iota(0, 2.05, 0.05).map!(x => x * PI);
	auto y = x.map!(sin);

	plt.plot(x, y, "r-", ["label": "$y=sin(x)$"]);
	plt.xlim(0, 2 * PI);
	plt.ylim(-1, 1);
	plt.legend();
	plt.savefig("simple.png");
	plt.clear();
}

Simple example

Color plot example:

import std.range; import plt = matplotlibd.pyplot;

void main() {
	const n = 100;
	auto x = iota(n);
	auto y = x[];
	double[n][n] z;
		
	foreach (i; 0..n)
		foreach (j; 0..n)
			z[i][j] = i + j;
	    
	plt.contourf(x, y, z, 64, ["cmap": "hsv"]);
	plt.colorbar();
	plt.savefig("color.png");
	plt.clear();
}

Color plot example

Authors:
  • koji-kojiro
Dependencies:
none
Versions:
0.1.7 2020-Jul-22
0.1.6 2019-Feb-20
0.1.5 2018-Dec-07
0.1.4 2016-Dec-26
0.1.3 2016-Dec-25
Show all 10 versions
Download Stats:
  • 0 downloads today

  • 0 downloads this week

  • 0 downloads this month

  • 284 downloads total

Score:
0.3
Short URL:
matplotlib-d.dub.pm