[R] lines on plot

Allan Engelhardt allane at cybaea.com
Thu May 20 22:23:56 CEST 2010


Some variation around

axis(2,at=2:7,lab=c("2","3","4","5","6","7"), tck=1)

should do it?  See tck in help("par").

Hope this helps.

Allan.

On 20/05/10 18:38, Anthony Lopez wrote:
> Is there an easier way to make this graph *without* having to specify all of
> the separate segment arguments at the end?
>
>    
>> x<- c(1,2)
>> off<- c(4,5.5)
>> def<- c(5.5,5.9)
>> par(fg="lightblue4")
>>
>>      
> plot(x,off,type="o",col="dodgerblue4",ylim=c(2,7),xlim=c(0.7,2.3),axes=F,xlab="Labor
> Condition",ylab="Willingness to Join",lwd=3)
>    
>> lines(def,type="o",pch=22,lty=2,col="firebrick",lwd=3)
>> axis(1,at=x,lab=c("Sufficient","Insufficient"))
>> axis(2,at=2:7,lab=c("2","3","4","5","6","7"))
>> segments(0,2,2.3,2)
>> segments(0,3,2.3,3)
>> segments(0,4,2.3,4)
>> segments(0,5,2.3,5)
>> segments(0,6,2.3,6)
>> segments(0,7,2.3,7)
>>      
> anthony
>
> 	[[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



More information about the R-help mailing list