Skip to content

Commit a45791a

Browse files
averissimom7pr
andauthored
Use 'ggplot2::annotate' for single annotation (#902)
# Pull Request - Fixes #901 ### Changes description - Annotation plotted only once - Correct expression <img width="870" height="560" alt="image" src="https://github.com/user-attachments/assets/8ca0b0db-5d97-45d4-8247-4db113e1eaa9" /> Co-authored-by: Marcin <[email protected]>
1 parent 29f33ff commit a45791a

File tree

1 file changed

+9
-12
lines changed

1 file changed

+9
-12
lines changed

R/tm_a_regression.R

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -830,18 +830,15 @@ srv_a_regression <- function(id,
830830
color = "red",
831831
linetype = "dashed"
832832
) +
833-
ggplot2::geom_text(
834-
ggplot2::aes(
835-
x = 0,
836-
y = mean(data$.cooksd, na.rm = TRUE),
837-
label = paste("mu", "=", round(mean(data$.cooksd, na.rm = TRUE), 4)),
838-
vjust = -1,
839-
hjust = 0,
840-
color = "red",
841-
angle = 90
842-
),
843-
parse = TRUE,
844-
show.legend = FALSE
833+
ggplot2::annotate(
834+
geom = "text",
835+
x = 0,
836+
y = mean(data$.cooksd, na.rm = TRUE),
837+
label = paste("mu", "=", round(mean(data$.cooksd, na.rm = TRUE), 4)),
838+
vjust = -1,
839+
hjust = 0,
840+
color = "red",
841+
angle = 90
845842
) +
846843
outlier_label,
847844
env = list(plot = plot, outlier = input$outlier, outlier_label = outlier_label())

0 commit comments

Comments
 (0)