fix x-axis ordering in ggplot2

前端 未结 1 861
被撕碎了的回忆
被撕碎了的回忆 2021-01-16 16:48

I have the following data

dftmp
   z.transient kprimes       groupname
1    -1.244061      10    k=9.8,p=56.4
2    -0.995249      20    k=9.8,p=56.4
3    -0.         


        
相关标签:
1条回答
  • 2021-01-16 16:56

    That's because your z.transient is a factor like you said. It seems to me that its a continuous variable no? If so, convert it from a factor to the value (see ?factor).

    dftmp$z.transient <- as.numeric(levels(dftmp$z.transient))[dftmp$z.transient]
    

    Also, as your data is now, if I use it directly the plot looks fine since z.transient is numeric. Try it, use:

    dftmp <- read.table('clipboard')
    

    Then follow your plotting steps...

    As far as axis limits, this post should steer you in the right direction.

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