[R] how to add these

Peter Ehlers ehlers at ucalgary.ca
Wed Dec 8 23:22:14 CET 2010


On 2010-12-08 12:24, casperyc wrote:
>
>
> Thomas Stewart wrote:
>>
>> It isn't clear to me what you want to do.  Do you want the axes to show?
>> Do
>> you want labels for the lines?  Do you want a legend?  What is your
>> desired
>> output?
>>
>> -tgs
>>
>> On Wed, Dec 8, 2010 at 2:42 PM, casperyc<casperyc at hotmail.co.uk>  wrote:
>>
>>>
>>> Hi All,
>>>
>>> How do I add these axis labels?
>>>
>>> ###############################################
>>> p=seq(0,1,length.out=500)
>>> p=p[-c(1,length(p))]
>>> g1=log(p/(1-p))
>>> g2=qnorm(p)
>>> g3=log(-log(1-p))
>>> g4=-log(-log(p))
>>> plot(p,g1,
>>>         'n',ylim=c(-5,5),las=1,
>>>         bty='n',
>>>         xaxt='n',yaxt='n',
>>>         xlab="",ylab=""
>>> )
>>> lines(p,g1,lty=1,col=1)
>>> lines(p,g2,lty=1,col=2)
>>> lines(p,g3,lty=1,col=3)
>>> lines(p,g4,lty=1,col=4)
>>>
>>> ###############################################
>>> Thanks!
>>>
>>> casper
>>>
>>> http://r.789695.n4.nabble.com/file/n3078908/123.jpeg 123.jpeg
>>> --
>>> View this message in context:
>>> http://r.789695.n4.nabble.com/how-to-add-these-axis-label-tp3078908p3078908.html
>>> Sent from the R help mailing list archive at Nabble.com.
>>>
[....snip....]
>>
>
>
> Hi,
>
> I am sorry that I want clear enough.
>
> I want the vertical axis and horizontal axis.
> I dont know how to get them, because they are kind of "in the middle" of the
> plot...
> and the hortizontal axis has 'double' labels.
>

You could do something like this (I'm pretty sure that
there's something like it in the R-help archives):

  plot(p, g1, type='n', ylim=c(-5,5),
    las=1, ann=FALSE, axes=FALSE)

## use the 'pos' argument to position the axis:
  axis(2, pos=0.5)
  abline(v=0.5)
  axis(1, pos=0)
  abline(h=0)

## now add a second horizontal axis; you have to
## do this twice; once for ticks and once for labels
  axis(1, pos=0, tck=.02, lab=NA, at=c(.1,.3,.6,.9))
  axis(1, pos=1.2, tick=FALSE, lab=letters[1:4], at=c(.3,.6,.9))

## now add your lines

Peter Ehlers


> Thanks!
>
> casper



More information about the R-help mailing list