# 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](https://github.com/benfred/contour_plot/releases/latest).
## Example
Draw the [Goldstein Price](https://en.wikipedia.org/wiki/File:Goldstein_Price_function.pdf) function:
```javascript
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](https://github.com/benfred/contour_plot/raw/master/image.png)
前端开源库-contour_plot
5星 · 超过95%的资源 需积分: 50 72 浏览量
2019-08-30
03:35:52
上传
评论
收藏 178KB ZIP 举报
weixin_38744153
- 粉丝: 346
- 资源: 2万+
最新资源
- 农村信用社联合社计算机信息系统投产与变更管理办.docx
- 农村信用社联合社计算机信息系统数据管理办法.docx
- 利用SPSS作临床效度分析线上计算网站介绍-医学研究部统计谘.(医学PPT课件).ppt
- 利用Zabbix监控mysqldump定时备份数据库状态.docx
- 利用计算机解决问题的基本过程.doc
- 化工铁路通信工程总结.doc
- 北京大学网络教育软件工程作业.docx
- 医药公司(连锁店)计算机操作规程未新系统的自行按照旧制修改-新系统过制的编号加修模版.doc
- 医药公司(连锁店)计算机系统操作规程模版.doc
- 医药连锁门店计算机系统的操作和管理程序未新系统的自行按照旧制修改-新系统过制的编号加修模版.docx
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈