How to identify if a scales trans object contains reverse in it?

Hi ggplot2/scales experts,

How might I make a logic statement that returns TRUE if a scales transform object contains reverse in it?

Thanks!
David

library(scales)
x <- identity_trans()
x
#> Transformer: identity [-Inf, Inf]
attributes(x)
#> $names
#> [1] "name"         "transform"    "inverse"      "d_transform"  "d_inverse"   
#> [6] "breaks"       "minor_breaks" "format"       "domain"      
#> 
#> $class
#> [1] "transform"

y <- reverse_trans()
y
#> Transformer: reverse [-Inf, Inf]
attributes(y)
#> $names
#> [1] "name"         "transform"    "inverse"      "d_transform"  "d_inverse"   
#> [6] "breaks"       "minor_breaks" "format"       "domain"      
#> 
#> $class
#> [1] "transform"

z <- transform_compose(log10_trans(), reverse_trans())
z
#> Transformer: composition(log-10,reverse) [1e-100, Inf]
attributes(z)
#> $names
#> [1] "name"         "transform"    "inverse"      "d_transform"  "d_inverse"   
#> [6] "breaks"       "minor_breaks" "format"       "domain"      
#> 
#> $class
#> [1] "transform"

Created on 2023-12-03 with reprex v2.0.2

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.