insightsengineering / insightsengineering/teal.goshawk
Validate addition of the line outside of the axis range
- 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.

---------
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))
```

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
Assessment
This issue has not been assessed yet.