Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

d3-contour

Package Overview
Dependencies
Maintainers
2
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

d3-contour

Compute contour polygons using marching squares.

  • 4.0.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2.7M
decreased by-1.32%
Maintainers
2
Weekly downloads
 
Created

What is d3-contour?

The d3-contour npm package is a part of the D3.js library and is used for generating contour plots, which are a way to represent three-dimensional data in two dimensions using contour lines. These plots are useful for visualizing scalar fields and can be used in various fields such as geography, meteorology, and data science.

What are d3-contour's main functionalities?

Generate Contours

This feature allows you to generate contour plots from a set of values. The `d3.contours` function is used to create a contour generator, which can then be used to compute contours for a given set of values. The `size` method sets the dimensions of the grid, and the `thresholds` method sets the contour levels.

const d3 = require('d3-contour');
const values = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
const contours = d3.contours().size([10, 10]).thresholds([1, 2, 3, 4, 5])(values);
console.log(contours);

Custom Thresholds

This feature allows you to use custom thresholds for generating contours. The `d3.thresholdSturges` function is used to compute thresholds based on Sturges' formula, which is a method for determining the number of bins in a histogram. These thresholds are then used to generate the contours.

const d3 = require('d3-contour');
const values = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
const thresholds = d3.thresholdSturges(values);
const contours = d3.contours().size([10, 10]).thresholds(thresholds)(values);
console.log(contours);

Smoothing Contours

This feature allows you to smooth the contours for a more visually appealing result. The `smooth` method is used to enable or disable smoothing. When smoothing is enabled, the contours are interpolated to create smoother lines.

const d3 = require('d3-contour');
const values = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
const contours = d3.contours().size([10, 10]).smooth(true)(values);
console.log(contours);

Other packages similar to d3-contour

Keywords

FAQs

Package last updated on 11 Jan 2023

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc