[R] Logarithmic axis

John Wiedenhoeft contact at wiedenhoeft.biz
Tue Nov 20 19:20:11 CET 2007

Hi there,

I guess this must be a standard issue, but I'm starting to go crazy with it. I 
simply want a plot with the x axis being logarithmic, having labels 1, 10, 
100..., and ten unlabelled ticks between each of them - just as they 
introduce logarithmic axis at school. I've played around a bit with log="x", 
xlog=T (where exactly is the difference here?), xaxp, and xaxt (unfortunately 
xaxt="l" isn't implemented). The best I get is a plot with an axis having a 
single 100 and nothing else...

here is what I've tried:

par(log="x", xlog=TRUE);
kennlinie1 <-  c(8.0746909, 3.9916973, 9.9789444, 19.962869);
kennlinie2 <-  c(6.0994206, 8.9661081, 19.924883, 31.879496);
reizstaerke <- c(76, 92, 108, 124);
#plot(reizstaerke, kennlinie1, ylim=c(0, max(kennlinie1, kennlinie2)), 
xlim=c(0, max(reizstaerke)), log="x", xlog=TRUE, xaxp=c(1, 2, 1), type="b");
#plot(reizstaerke, kennlinie1, type="b", log="x", xlog=TRUE, xaxp=c(1, 2, 3));
plot(reizstaerke, kennlinie1, type="b",usr=c(min(reizstaerke), 
max(reizstaerke), min(kennlinie1, kennlinie2), max(kennlinie1, kennlinie2)), 
log="x", xlog=TRUE, xaxp=c(1, 2, 3));
#points(reizstaerke, kennlinie2, xlog=TRUE, xaxp=c(1, 3, 3), type="b");

Certainly I've missed something, but I can't figure it out.

Any help appreciated,

platform       i486-pc-linux-gnu
arch           i486
os             linux-gnu
system         i486, linux-gnu
major          2
minor          4.1
year           2006
month          12
day            18
svn rev        40228
language       R
version.string R version 2.4.1 (2006-12-18)

More information about the R-help mailing list