Skip to content

how to add these "axis" label?

5 messages · casperyc, Thomas Stewart, Peter Ehlers

#
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
#
Thomas Stewart wrote:
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.

Thanks!

casper
#
On 2010-12-08 12:24, casperyc wrote:
[....snip....]
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