ggplot比例尺x轴以立方为单位

问题描述 投票:3回答:1

我想通过定义一个新函数来将x轴缩放为立方正方形。

cuberoot_trans = function(){
 trans = function(x) x^(1/3)
 }

ggplot(data = diamonds, aes(x=carat, y=price)) + 
 geom_point(alpha=1.5, size=0.75, position = 'jitter') +
 scale_x_continuous(breaks = c(0.2, 0.5, 1, 2, 3), limits = c(0.2, 3), trans = cuberoot_trans()) 

paste0(x,“ _trans”)中的错误:无法将类型'closure'强制转换为类型'character'的向量]

我在做什么错?

r ggplot2 scale
1个回答
© www.soinside.com 2019 - 2024. All rights reserved.