insightsengineering / insightsengineering/teal.goshawk

Validate addition of the line outside of the axis range

Open
#139 6 comments 0 reactions 0 assignees View on GitHub
bug core
Dominant language
R
Stars
3
Forks
3
Avg merge
2d 6h
Merged PRs (30d)
11

Description

When adding a new line outside of the plot range new element is added to the legend.

![Screenshot (567)](https://user-images.githubusercontent.com/6959016/162158990-873a2094-afdb-4d68-929e-d6e18253c179.png)

---------

Explanation:

`goshawk:::geom_arb_line` works in the same way as the `ggplot2::geom_hline` but it adds the legend also per (color, label).

```r
library(ggplot2)
data <- data.frame(
x = seq_len(10),
y = seq_len(10),
arm = rep(c("a", "b"), each = 5),
lower = rep(2, each = 5),
upper = rep(8, each = 5)
)
p <- ggplot(data, aes(x = x, y = y, color = arm)) +
geom_point()

p + goshawk:::geom_arb_hline(yintercept = c(2, 3, 15))
```

image

Axis limits are controlled in goshawk::` which has this functionality to always keep plot within specific axis range.

https://github.com/insightsengineering/goshawk/blob/7d9ff6e413225961e224bb8666abf3fa8c9ea7a9/R/g_correlationplot.R#L293

All above means that we have to control this in `teal.goshawk ` modules, to not add lines which are outside of the range. Please validate a new line entry by the inputs from x/y range slider.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.