Apply two transformations on one axis

后端 未结 3 900
一生所求
一生所求 2021-01-21 02:16

I have found coord_trans, but I\'d like to apply log10 and reverse to my x-axis. I tried applying two transformation

ggplo         


        
3条回答
  •  悲哀的现实
    2021-01-21 02:51

    A quick and easy way is to apply one of the transformations directly to the data and use the other with the plot function.

    e.g.

    ggplot(iris, aes(log10(Sepal.Length), log10(Sepal.Width), colour = Species)) + 
    geom_point() + coord_trans(x="reverse", y="reverse")
    

    Note: the reverse transformation does not work with the iris data but you get the idea.

提交回复
热议问题