Skip to content

Commit

Permalink
Fix plot unit tests
Browse files Browse the repository at this point in the history
One unit test uses get_xlim(), which was removed earlier because it's
not used internally. get_ylim() no longer returns a list, so there's
no need to subset.
  • Loading branch information
joshuaulrich committed Aug 29, 2023
1 parent 577b171 commit e0435d6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions R/plot.R
Original file line number Diff line number Diff line change
Expand Up @@ -929,6 +929,7 @@ new.replot_xts <- function(panel=1,asp=1,xlim=c(1,10),ylim=list(structure(c(1,10
# getters
get_panel <- function(n) { if (n == 0) get_last_action_panel() else Env$panels[[n]] }
get_ylim <- function() { update_panels(); get_active_panel()[["ylim_render"]] }
get_xlim <- function() { update_panels(); Env$xlim }
get_active_panel <- function() { get_panel(Env$active_panel_i) }
get_last_action_panel <- function() { get_panel(Env$last_action_panel_id) }

Expand Down Expand Up @@ -1385,6 +1386,7 @@ new.replot_xts <- function(panel=1,asp=1,xlim=c(1,10),ylim=list(structure(c(1,10
replot_env$update_panels <- update_panels
replot_env$render_panels <- render_panels
replot_env$get_panel <- get_panel
replot_env$get_xlim <- get_xlim
replot_env$get_ylim <- get_ylim
replot_env$create_ylim <- create_ylim
replot_env$get_last_action_panel <- get_last_action_panel
Expand Down
2 changes: 1 addition & 1 deletion inst/tinytest/test-plot.R
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ expect_equivalent(target, p$get_xlim(), info = info_msg)
info_msg <- "test.ylim_set_before_rendering"
x <- rnorm(10)
p <- plot(xts(x, .Date(1:10)))
expect_equivalent(range(x), p$get_ylim()[[2]], info = info_msg)
expect_equivalent(range(x), p$get_ylim(), info = info_msg)

info_msg <- "test.yaxis.ticks"
x <- xts(rnorm(50), .Date(1:50))
Expand Down

0 comments on commit e0435d6

Please sign in to comment.