[R] Annotation Ticks on the axis

Vivek Sutradhara viveksutra at gmail.com
Fri Aug 11 11:01:44 CEST 2017


Hi all,

I would like to have help in getting annotation ticks (corresponding to the
minor grid) on my plot. Here is my toy example :


par(mar=c(5, 6, 5, 5) + 0.1)

x<-1:10

y<-x^2

plot(x,y,log="xy",xlab="log(x)",ylab="log(y)")

par(new=T)

plot(log(x),log(y),type='n',col="red",xaxt="n",yaxt="n",xlab="",ylab="")

axis(side=3,tick=TRUE,at=pretty(range(log(x))))

mtext("log(x) with log labels",side=3,line=3)

axis(side=4,tick=TRUE,at=pretty(range(log(y))))

mtext("log(y) with log labels",side=4,line=3)

par()


I have the following questions :

1. I get a long output after the final par command. How can I make this
output silent?

2. I would like to get ticks corresponding to the command
annotation_logticks in ggplot2. Actually, it would be easiest for me to
work directly with ggplot. But I am not able to implement the secondary
axis option with ggplot. Would appreciate help with that, if it is easier.

Thanks,

Vivek

	[[alternative HTML version deleted]]



More information about the R-help mailing list