npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

plotty

v0.4.9

Published

plotty ======

Downloads

8,233

Readme

plotty

plotty is a library for helping plot 2D data and provide color scaling functionality. Put your array data in it and receive a fresh image.

Installation

Installation with Bower:

bower install --save santilland/plotty

Installation with npm:

npm install plotty --save

Docs

http://santilland.github.io/plotty/

Usage

Just include script to site and add a canvas element where you want to render the data.

<head>
  <script src="dist/plotty.min.js"></script>
</head>
<body>
  <canvas id="canvas" width=100 height=100></canvas>
</body>

and render using predefined settings:

// Generate or load some data (Working with buffer arrays for now)
var width = 100;
var height = 100;
var exampledata = new Float32Array(height * width);

var xoff = width / 3;
var yoff = height / 3;

for (y = 0; y <= height; y++) {
  for (x = 0; x <= width; x++) {
    // calculate sine based on distance
    x2 = x - xoff;
    y2 = y - yoff;
    d = Math.sqrt(x2*x2 + y2*y2);
    t = Math.sin(d/6.0);

    // save sine
    exampledata[(y*width)+x] = t;
  }
}

plot = new plotty.plot({
  canvas: document.getElementById("canvas"),
  data: exampledata, width: width, height: height,
  domain: [-1, 1], colorScale: 'viridis'
});
plot.render();

There is a list of predefined colorscales:

| | | | | --------- | ----------- | ---------- | | viridis | inferno | turbo | | rainbow | jet | hsv | | hot | cool | spring | | summer | autumn | winter | | bone | copper | greys | | ylgnbu | greens | ylorrd | | bluered | rdbu | picnic | | portland | blackbody | earth | | electric | magma | plasma |

It is also possible to define your own colorscale using the addColorScale function.

plotty.addColorScale("mycolorscale", ["#00ff00", "#0000ff", "#ff0000"], [0, 0.5, 1]);
//                  ( identifier   ,  color_steps,                    , percentage_steps)

Development

The following npm commands are provided to help with the development:

  • npm run build: Build a non-minified version of plotty.
  • npm run build-min: Build a minified version of plotty.
  • npm run watch: Start a watcher that continuously builds plotty upon changes.
  • npm start: Start a development server.
  • npm run jsdoc: Build the documentation.

Examples

Generated data:

Example plotty rendering

Scientific data:

Second Example plotty rendering