Conversation
…anslation we apply on lower DPI screens
mbostock
left a comment
There was a problem hiding this comment.
The description and the code feel inconsistent: the description says “we want the same image independently of the slight translation we apply on lower DPI screens” which I interpret to mean that the hexbin transform should not consider the offset, but the code changes seem to do the opposite — now the hexbin transform depends on the offset.
Also, the hexgrid mark now in effect applies the opposite offset (negative rather than positive), which means that the hexgrid won’t line up with a dot mark or line mark.
Can you elaborate on what we are trying to fix here? I’m not following, sorry.
|
Here’s a notebook that demonstrates the inconsistency. We need Plot.dot to be consistent with Plot.hexgrid because the two are often used together, and more generally we want all marks to be positioned consistently. The test code is: Plot.plot({
width: 640,
height: 400,
x: { type: "identity" },
y: { type: "identity" },
marks: [
Plot.frame(),
Plot.dot(
d3.cross(d3.ticks(0, 640, 40), d3.ticks(0, 400, 40)),
Plot.hexbin(
{},
{
r: r,
binWidth: r * 2,
stroke: "magenta",
strokeWidth: 3,
clip: true
}
)
),
Plot.hexgrid({
binWidth: r * 2,
stroke: "cyan",
strokeWidth: 1.5,
strokeOpacity: 1
})
]
})Here is the desired behavior from main:
And here is the behavior in this branch (note the shift between cyan and magenta):
|


Per @Fil: we want the same image independently of the slight translation we apply on lower DPI screens