Plot.plot({
height: 630,
width: width,
x: { domain: [-10, 180], label: "theta" },
y: { domain: [-40, 40], label: "r" },
clip: true,
marks: [
Plot.frame({
opacity: 1,
stroke: d3.schemeTableau10[2],
strokeWidth: 2,
fill: "black"
}),
Plot.ruleX([0], { opacity: 0.5 }),
Plot.ruleY([0], { opacity: 0.5 }),
...complexSlope
.flatMap(({ m, b }) =>
build_samples((x) => m * x + b, -10, 10, { N: 50 }).map((point) =>
build_samples(
(theta) =>
point[0] * Math.cos((theta * Math.PI) / 180) +
point[1] * Math.sin((theta * Math.PI) / 180),
-10,
180,
{ N: 10 }
)
)
)
.map((points, i) => Plot.line(points, { stroke: "white", opacity: 0.2 }))
]
})