且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

R:自定义ggplot2颜色转换给标签中的错误

更新时间:2023-09-23 20:18:40

There is a vectorized if, called ifelse. It also seems you are missing an extra minus.

super_trans <- function() {
     trans_new('super', 
               function(x) ifelse(x>0, x^0.5, -(-x)^0.5), 
               function(x) ifelse(x>0, x^2, -(-x)^2))
}

相关阅读

推荐文章