show 0 in a log scale y axis of plot in R

后端 未结 3 1831
孤城傲影
孤城傲影 2021-01-22 05:25

Because the y values are too small, I need to use a log scale for y axis to show the differences. In the data, some entries do not have any value (0). Is there any way to show \

3条回答
  •  谎友^
    谎友^ (楼主)
    2021-01-22 05:29

    Choose some minimum value, and use that to represent 0:

    m <- min(y[y!=0])/10
    plot(x, pmax(y, m), log="y")
    

    enter image description here

提交回复
热议问题