Socket
Socket
Sign inDemoInstall

contour_plot

Package Overview
Dependencies
0
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    contour_plot

Contour Plots of Mathematical Functions


Version published
Weekly downloads
138K
increased by2.42%
Maintainers
1
Install size
63.1 kB
Created
Weekly downloads
 

Readme

Source

contour_plot

A D3 plugin to draw contour plots of 2D functions.

Uses the marching squares algorithm from d3.geom.contour to generate contour lines.

This project is a work in progress, and not ready for public consumption. Notably this doesn't generate

Installing

If you use NPM, npm install contour_plot. Otherwise, download the latest release.

Example

Draw the Goldstein Price function:

function goldsteinPrice(x, y) {
    return (1. + Math.pow(x + y + 1, 2) *
    (19 - 14*x + 3*x*x - 14 * y + 6 * x * x + 3 * y * y))
    * (30 + Math.pow(2*x-3*y, 2)*(18 - 32*x + 12 * x * x + 48*y - 36 * x * y + 27 * y* y));
}

var plot = contour_plot.ContourPlot()
    .f(goldsteinPrice)
    .drawAxis(true)
    .xDomain([-2, 2])
    .yDomain([1, -2])
    .colourRange(["white", "green"]);

var elements = plot(d3.select("#contour_graph"));

Should produce something like:

Example

Keywords

FAQs

Last updated on 30 Oct 2016

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