This message was deleted.
# help
s
This message was deleted.
y
The aspectRatio option might be useful here
👍 1
f
m
I tried to use Plot.dot() but I don't get the squares quite right...🤔 https://observablehq.com/d/5d5311214384cb25
g
The notebook suggested by @Fil is indeed like what I want to do, except it is entirely in "classical" d3 plotting (e.g., creating scales for mapping, applying them to SVG objects). I know how to do that. I was hoping for something using the new Plot. @Mihael Ankerst suggestion is the key. Create a Plot to expose the mappings and then work backwords. Awkward, but I will explore that avenue. Or maybe just use the d3 plot that works fine! Thanks to both for the suggestions.
m
@Gary McClelland : It seems your use case is best tackled by doing the bases graph without the squares in Plot first. So you have an SVG. Then you use the power of d3 to add your specifics to it. In my use of Plot.dot() you see it’s not a good fit to your question. The r scale type might better be „identity“ but with all the extra passing of information it seems at best to be a „hack“
f
m
Thanks to @Fil s suggestion the link is updated
m
If you want the rule too, you can add:
Copy code
Plot.ruleX(data, {
      x: "x",
      y1: "y",
      y2: (d) => my_graph.predict(d.x),
      stroke: "red"
    }),
Like so
❤️ 1
m
Thanks so much! @Fil and @Mike Bostock. I have put it all together , wrote down some learnings 💡 and published it here: https://observablehq.com/@ee2dev/drawing-a-square-with-plot