Split a plot into 2 horizontal parts in R -


i want make plot in r following data:

1.txt 3.103 12 2.txt 3.020 11 3.txt 2.929 10 4.txt 3.020 11 5.txt 2.929 10 a.txt 4.254 39 b.txt 4.228 38 c.txt 4.175 36 d.txt 4.175 36 e.txt 4.175 36 

i want have variable stores values second column , 1 third. problem lines far apart , if set ylim=c(3,40), first line straight not true in case.

how can solve this?

i thinking maybe of splitting plot horizontal line , below have right values second column , above ones third column, not know how this. approach?

this code have far:

plot(a,type="o",col="blue",pch=0,lty=2,xaxt="n",ylim=c(3,40)) lines(b,type="o",col="green",pch=5,lty=3) axis(side=1,at=seq(1,45,1),cex.axis=0.5,las=1) 

and plot: enter image description here

you normalise before plotting:

#reproducible data df <- read.table(text="1.txt 3.103 12 2.txt 3.020 11 3.txt 2.929 10 4.txt 3.020 11 5.txt 2.929 10 a.txt 4.254 39 b.txt 4.228 38 c.txt 4.175 36 d.txt 4.175 36 e.txt 4.175 36")  #normalise 0-1 range #(m - min(m))/(max(m)-min(m)) df$v2 <- (df$v2-min(df$v2))/(max(df$v2)-min(df$v2)) df$v3 <- (df$v3-min(df$v3))/(max(df$v3)-min(df$v3))  #plot plot(df$v2,type="o",col="blue",pch=0,lty=2,xaxt="n") lines(df$v3,type="o",col="green",pch=5,lty=3) axis(side=1,at=seq(1,45,1),cex.axis=0.5,las=1) 

enter image description here


Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -