Yes, although I set the *x* force to be much stronger than the *y* force, it's still moving sideways. You might prefer to apply the "dodge" algorithm to avoid this. I haven't yet taken the time to do it.
This is a great example. Dumb question: How would set a custom maximum and minimum radius to the circles? They seem to be autoscaled here in a way I don't know how to override.
> How can you use D3 code within Plot?
It's just JavaScript :)
> what is the .render function, and is there any documentation about this? Thanks!
The render function is called by plot on each mark (and each facet), and returns the SVG content that the mark defines, for example a <g> containing a bunch of <circle> for the dot mark.
This function is not fully documented, because it's not completely stabilized yet (see issue https://github.com/observablehq/plot/issues/1263). This is why I try to be careful to label all the extensions I make as "experimental".
The function is called with the following arguments: an index (decorated with facet information), the scales, the scaled channels, the frame's dimensions, and a context (which you can use to create a new DOM element, or check the projection).
The index is an array of integers that lists the values to represent in that facet. The channels are indexed with the same values.
For example, this is how Plot.dot reads the position (cx, cy) of the dots it needs to render: Array.from(index, (i) => [channels.x[i], channels.y[i]])
The scales argument is possibly going to change soon, because as part of the public API it should probably return scales in the same format as the chart.scale() method… which is not the case currently. See https://github.com/observablehq/plot/pull/1265 on that topic. Note that the channels are already scaled (in screen space), so most of the time you don't need the scales.
Besides the scales, I don't expect huge changes to the API before we release version 1. What we're discussing will mostly be additions.
I hope this clarifies and gives you enough information to start; don't hesitate to ask if you need more details.