Plotting scatterplots with pairs in R, in log scale with data containing zeros

后端 未结 1 692
慢半拍i
慢半拍i 2021-01-21 05:22

I am trying to plot some pairs of scatterplots using \"pairs\". My dataframe look like :

    >e
    X Y Z
    0 0 0
    2 3 4
    0 3 4
    3 3 3
1条回答
  •  清歌不尽
    2021-01-21 06:20

    You ignored this (where I called your data frame DF):

    R> pairs(~X+Y+Z, data=df, log="xy")
    There were 30 warnings (use warnings() to see them)
    

    and if you look at these thirty warnings, you will see that

    • you cannot plot data containing zeros on a log scale (and I guess you know why)

    • log is not a recognised parameter for pairs()

    So if you want a pairs plot in logs, you may have to takes logs yourself (and either add a small epsilon or use a transformation like log(1 + x) and call pairs() on that data.

    Edit The easiest is probably pairs(~X+Y+Z, data=log(1+DF))

    0 讨论(0)
提交回复
热议问题