Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Validate addition of the line outside of the axis range #139

Open
gogonzo opened this issue Apr 6, 2022 · 1 comment
Open

Validate addition of the line outside of the axis range #139

gogonzo opened this issue Apr 6, 2022 · 1 comment
Labels
bug Something isn't working core

Comments

@gogonzo
Copy link
Contributor

gogonzo commented Apr 6, 2022

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

Screenshot (567)


Explanation:

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

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.

@gogonzo gogonzo added the bug Something isn't working label Apr 6, 2022
@gogonzo gogonzo changed the title Should arbitrary line affect axis Validate addition of the line outside of the axis range Apr 7, 2022
@gogonzo gogonzo mentioned this issue Apr 8, 2022
@npaszty
Copy link
Contributor

npaszty commented Apr 11, 2022

@gogonzo
is it bad to have the line value expand the axis to incorporate it? If user adds line that falls outside the axis range which is driven only by existing data range then they can use the zoom slider to expand the range so that the line is visible and with that you would want to have it displayed in the legend.

@donyunardi donyunardi added the core label Aug 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working core
Projects
None yet
Development

No branches or pull requests

3 participants