r - ggplot: line with different widths -


with ggplot2, easy plot line 2 colours, based on value of "col" variable, possible plot line left part 1 width , right part 1 ?

you different width lines if use size= argument inside aes() , set variable divides data.

the of plot depend on variable divides data in groups.

if variable factors gap between parts of lines.

df1<-data.frame(x=1:10,y=1:10,z=rep(c("a","b"),each=5)) ggplot(df1,aes(x,y,size=z))+geom_line() 

enter image description here

if variable numeric there no gap.

df2<-data.frame(x=1:10,y=1:10,z=c(1,1,1,2,2,2,3,3,4,4)) ggplot(df2,aes(x,y,size=z))+geom_line() 

enter image description here


Comments

Popular posts from this blog

windows - Single EXE to Install Python Standalone Executable for Easy Distribution -

c# - Access objects in UserControl from MainWindow in WPF -

javascript - How to name a jQuery function to make a browser's back button work? -