From 6b916c5c4e505e602bc18eec47a85edd21c24d82 Mon Sep 17 00:00:00 2001 From: Aakriti Kushwaha Date: Fri, 23 Jan 2026 22:18:29 +0530 Subject: [PATCH 1/5] Increase default stroke-width for geom_point when color_off is used --- inst/htmljs/animint.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/inst/htmljs/animint.js b/inst/htmljs/animint.js index 04c21430..59e6a7e9 100644 --- a/inst/htmljs/animint.js +++ b/inst/htmljs/animint.js @@ -1134,14 +1134,20 @@ var animint = function (to_select, json_file) { var get_style_on_stroke_width = get_size; // stroke_width for geom_point - var stroke_width = 1; // by default ggplot2 has 0.5, animint has 1 + var stroke_width = 1; // default + + // If color_off is used, make stroke more visible + if(aes.hasOwnProperty("color_off")){ + stroke_width = 2; + } + var get_stroke_width; if(aes.hasOwnProperty("stroke")){ get_stroke_width = get_attr("stroke"); }else{ get_stroke_width = function(d){ - return stroke_width; - }; + return stroke_width; + }; } var linetype = "solid"; From e8c4d3d430479d6c678cd2f9336dd280afb8c8be Mon Sep 17 00:00:00 2001 From: Aakriti Kushwaha Date: Fri, 23 Jan 2026 22:32:21 +0530 Subject: [PATCH 2/5] Increase stroke-width for geom_point when color_off is used --- inst/htmljs/animint.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/inst/htmljs/animint.js b/inst/htmljs/animint.js index 59e6a7e9..06db1c21 100644 --- a/inst/htmljs/animint.js +++ b/inst/htmljs/animint.js @@ -1136,18 +1136,18 @@ var animint = function (to_select, json_file) { // stroke_width for geom_point var stroke_width = 1; // default - // If color_off is used, make stroke more visible + // Make stroke more visible when color_off is used if(aes.hasOwnProperty("color_off")){ - stroke_width = 2; - } + stroke_width = 2; + } var get_stroke_width; if(aes.hasOwnProperty("stroke")){ - get_stroke_width = get_attr("stroke"); + get_stroke_width = get_attr("stroke"); }else{ - get_stroke_width = function(d){ - return stroke_width; - }; + get_stroke_width = function(d){ + return stroke_width; + }; } var linetype = "solid"; From 9d5f4dd22f711667de90de091eab64f7a6e4dd1e Mon Sep 17 00:00:00 2001 From: Aakriti Kushwaha Date: Sun, 25 Jan 2026 21:24:02 +0530 Subject: [PATCH 3/5] Add renderer test for selectors without hasOwnProperty --- tests/testthat/test-renderer-selectors.R | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 tests/testthat/test-renderer-selectors.R diff --git a/tests/testthat/test-renderer-selectors.R b/tests/testthat/test-renderer-selectors.R new file mode 100644 index 00000000..a3d60e95 --- /dev/null +++ b/tests/testthat/test-renderer-selectors.R @@ -0,0 +1,20 @@ +test_that("animint renderer works without Selectors.hasOwnProperty", { + skip_on_cran() + + library(animint2) + + df <- data.frame( + x = 1:3, + y = 1:3, + grp = c("a", "b", "c") + ) + + p <- ggplot(df, aes(x, y)) + + geom_point(clickSelects = "grp") + + tmp <- withr::local_tempdir() + + expect_silent( + animint(list(plot = p), out.dir = tmp) + ) +}) \ No newline at end of file From 00b2c3369ef9a436649f55deb910ae95b2f8a80b Mon Sep 17 00:00:00 2001 From: Aakriti Kushwaha Date: Sun, 25 Jan 2026 21:36:40 +0530 Subject: [PATCH 4/5] Ignore .DS_Store files --- .gitignore | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 80b74d00..3ea6ad5b 100644 --- a/.gitignore +++ b/.gitignore @@ -11,4 +11,5 @@ *pids.txt *~ .vscode/settings.json -/node_modules \ No newline at end of file +/node_modules.DS_Store +.DS_Store From f1c7c0bf17ea7df7822f68b00a9fe3431ebe24d3 Mon Sep 17 00:00:00 2001 From: Aakriti Kushwaha Date: Wed, 28 Jan 2026 01:18:01 +0530 Subject: [PATCH 5/5] Add hard test for bisection animint2 visualization --- ...dtest-renderer-bisection_hard_test_trial.R | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 tests/testthat/Untitledtest-renderer-bisection_hard_test_trial.R diff --git a/tests/testthat/Untitledtest-renderer-bisection_hard_test_trial.R b/tests/testthat/Untitledtest-renderer-bisection_hard_test_trial.R new file mode 100644 index 00000000..0c52ffcc --- /dev/null +++ b/tests/testthat/Untitledtest-renderer-bisection_hard_test_trial.R @@ -0,0 +1,37 @@ +library(ggplot2) +library(animint2) + +# Make iteration a factor +bisection_df <- data.frame( + x = seq(-2, 2, length.out = 100), + y = (seq(-2, 2, length.out = 100))^3 - seq(-2, 2, length.out = 100), + iteration = factor(rep(1:5, each = 20)) +) + +interval_df <- data.frame( + m = c(-1, -0.5, 0, 0.5, 1), + iteration = factor(1:5) +) + +# Create the animint2 object using showSelected as a parameter +bisection_animint2 <- animint( + plot1 = ggplot(bisection_df, aes(x = x, y = y)) + + geom_line(showSelected = "iteration") + # parameter, not inside aes() + geom_segment( + data = interval_df, + aes(x = m, xend = m, y = -Inf, yend = Inf), + showSelected = "iteration", # parameter here + color = "red" + ) + + labs(title = "Bisection Method Visualization", x = "x", y = "f(x)"), + + # Animation settings + time = list(variable = "iteration", ms = 2000) +) + +# Render +animint2dir( + bisection_animint2, + out.dir = "~/Desktop/animint-gallery/bisection_animint2_render", + open.browser = TRUE +) \ No newline at end of file