JetBrains / JetBrains/lets-plot

`geom_contour`: correct shape of isolines requires a complete grid

Open
#1,356 2 comments 0 reactions 0 assignees View on GitHub
ggplot2
Dominant language
Kotlin
Stars
1.8k
Forks
60
PR merge metrics
No merged PRs in 30d

Description

When the input grid for `geom_contour()` contains points with `z = 0`, removing these zero-value nodes causes a noticeable distortion in the shape of the contour lines. This makes contour plots highly sensitive to the presence of zero-value nodes, even when those nodes are outside the actual contour levels of interest.

Example:

```python
data = {
'x': [1, 2, 3, 4, 0, 1, 2, 3, 4, 0, 1, 2, 3, 4, 0, 1, 2, 3, 4, 0, 1, 2, 3, 4],
'y': [0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4],
'z': [1, 4, 9, 16, 1, 2, 5, 10, 17, 4, 5, 8, 13, 20, 9, 10, 13, 18, 25, 16, 17, 20, 25, 32],
}

ggplot(data) + geom_contour(aes('x', 'y', z='z')) + coord_fixed()
```

Output:

output

Expected:

expected output

In ggplot2 with the same data:

ggplot2 output

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.