JetBrains / JetBrains/lets-plot

`geom_contour`: error if data is not sorted properly

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

Description

`geom_contour()` fails with an unclear error when the input data is not ordered in a specific way. This happens even when the data forms a valid and complete grid.

Example:
```python
df = pd.DataFrame({
'x': [0, 0, 1, 1],
'y': [0, 1, 0, 1],
'z': [0, 1, 2, 3],
})

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

Output:

```
Data grid must be at least 2 columns wide (was 1)
```

Reordering the rows (e.g. by sorting) makes the plot work. For example:

```python
ggplot(df.sort_values(by=["y", "x"])) + geom_contour(aes('x', 'y', z='z')) + coord_fixed()
```

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.