Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In plotters-rs/plotters#165 the tick lines look like they're two pixels wide instead of one as intended, as well as at half opacity, which would indicate that the error comes from the line being rendered on the border between two pixel rows instead of within one row of pixels.
This change moves line endpoints by +0.5 in both the x and y direction so that the endpoints lie in the centers of pixels. That by itself however would leave the pixels at the line ends only half-covered, so we need to add the square linecap to the lines which then completely fills up the endpoint pixels.
Here is the new behaviour of the wasm-demo example when selecting "Graph of y=x^3" in the drop-down.



A downside of this approach is that this slightly changes the behaviour of line-width. A LineSeries with width 20 will now continue for 10 more pixels on either side. Is this a problem? See example here: