Luigi Marongiu wrote:

dear all,
I have a xy plot in which x is logarithmic. The plot is fine,
and I can
also represent the logarithimic axis usign a tip given me by
William
Dunlap. However I would like to plot the actual x value rather
than the
log10 s in this case. If I remove the xaxt="n" the plot reports
the
scientific notation of the log, a rough version of the nice
notation
written by William Dunlap.
So how can I write the value of the x axis?

################################################################
############

y<-c(25.84, 26.84, 27.85, 28.86, 29.86, 30.87, 31.88, 32.88,
33.89,
34.90, 35.90, 36.91)
x<- c(1000, 500,  250,  125,  62.50,  31.25,  15.63,  7.81,
3.91,  1.95,
  0.98,  0.49)

plot(x, y, pch=16, type="b",  log="x", xaxt="n",
ylab=expression(bold("Y
axis")), xlab=expression(bold("X axis")))

  xlim<- par("usr")[1:2]
  lab.x<- seq(ceiling(xlim[1]), floor(xlim[2]))
  axis(side=1, at=10^lab.x, lab=as.expression(lapply(lab.x,
function(x)bquote(10^.(x)))))

################################################################
###########

Hi Luigi,
Your x-axis has a lot of labels, but you can pack them in like this:

library(plotrix)
staxlab(1,at=c(0.49, 0.98, 1.95, 3.91, 7.81, 15.63, 31.25, 62.50,
 125, 250, 500, 1000))

Jim

______________________________________________
R-help@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.

Reply via email to