There is an excellent notebook on using Plot.contour() at Contour Mark / Observable Plot / Observable | Observable but it is mostly for plotting contours of densities. I want to plot a contour for a function. The last example in that notebook illustrates plotting contours for function but using facets. I’m having trouble sorting out which parts of the code are for the facets and which for the function. Unfortunately, the API does not mention using Plot.contour for functions. So I need help! This is what I’m trying to do:
Plot.plot({
marks: [
Plot.contour({
fill: (x, y) => binorm(x, y, 0),
x1: -3,
y1: 3,
x2: 3,
y2: 3
})
]
})
where binorm(x,y,r) is the pdf for the bivariate normal distribution, which I’ve tested and it is outputting correct values in the range of 0 to about 0.16. But nothing appears. My simple notebook is at Bivariate Normal Distribution / Seeing Statistics | Observable