Skip to content

can't plot ylab in graph

2 messages · Faheem Mitha, Brian Ripley

#
Dear People,

I am sure I am missing something obvious as usual, but in the following
graph I can't plot ylab.

Ignoring unimportant details, I am plotting one instance of truehist() and
one instance of curve() on the same graph. Truehist() won't let me pass
the ylab argument. It gives me the error

Error in plot.default(xlim, c(0, ymax), type = "n", xlab = xlab, ylab =
"",  : formal argument "ylab" matched by multiple actual arguments

I don't understand the error. I looked at the help page for truehist().
The xlab argument was present but the ylab argument was missing.

I can pass the argument to curve but it is ignored. I tried adding it to
the line par(new=T) below, but that didn't do anything either.

Thanks in advance for any help.

                                                   Faheem.

************************************************************************

mg.hist <- function(len,theta,pos,size)
{
  x <- empmargdistvec(len,theta,pos,size)

  postscript(file="plot.ps", horizontal = FALSE, onefile = FALSE, paper
             = "special", width=6, height=4)
  par(mfcol=c(1,2),pch=20)

  truehist(x, nbins=100,xlab=expression(paste("Range ", (theta))))

  mydensityfn <- function(x)
    {
      mydensity(x,theta,pos,len)
    }
  par(new=T)
  curve(mydensityfn, col = "red", add=TRUE)

...
}
#
On Fri, 2 May 2003, Faheem Mitha wrote:

            
Right, so why do you think it accepts `ylab'?  There seems to be a crop of
people asking questions or sending bug reports who think `xlab' and `ylab'
are graphical parameters, but that are actually arguments to title() which
plot.default passes through.

What you can do is call title(), as in

library(MASS)
truehist(rnorm(100))
title(ylab="some y label")