@@ -28,9 +28,8 @@ test_that("coord_fixed() is translated to the right height-width ratio", {
2828 la <- info $ layout
2929 expect_identical(tr $ type , " scatter" )
3030 # height-width ratio check
31- built <- ggplot_build2(p )
32- x_range <- range(built [[2 ]]$ ranges [[1 ]]$ x.major_source , na.rm = TRUE )
33- y_range <- range(built [[2 ]]$ ranges [[1 ]]$ y.major_source , na.rm = TRUE )
31+ x_range <- range(p $ data $ xval , na.rm = TRUE )
32+ y_range <- range(p $ data $ yval , na.rm = TRUE )
3433 yx_ratio <- (y_range [2 ] - y_range [1 ]) / (x_range [2 ] - x_range [1 ])
3534 expect_identical(la $ height / la $ width , yx_ratio * p $ coordinates $ ratio )
3635})
@@ -45,8 +44,8 @@ test_that("coord_fixed() is translated to the right height-width ratio", {
4544 expect_identical(tr $ type , " scatter" )
4645 # height-width ratio check
4746 built <- ggplot_build2(p )
48- x_range <- range(built [[ 2 ]] $ ranges [[ 1 ]] $ x.major_source , na.rm = TRUE )
49- y_range <- range(built [[ 2 ]] $ ranges [[ 1 ]] $ y.major_source , na.rm = TRUE )
47+ x_range <- range(p $ data $ xval , na.rm = TRUE )
48+ y_range <- range(p $ data $ yval , na.rm = TRUE )
5049 yx_ratio <- (y_range [2 ] - y_range [1 ]) / (x_range [2 ] - x_range [1 ])
5150 expect_identical(la $ height / la $ width , yx_ratio * p $ coordinates $ ratio )
5251})
0 commit comments