generated from erosita/uds
submit
This commit is contained in:
32
Spectra/figures/test.r
Normal file
32
Spectra/figures/test.r
Normal file
@@ -0,0 +1,32 @@
|
||||
minor.ticks.axis <- function(ax,n,t.ratio=0.5,mn,mx,...){
|
||||
|
||||
lims <- par("usr")
|
||||
if(ax %in%c(1,3)) lims <- lims[1:2] else lims[3:4]
|
||||
|
||||
major.ticks <- pretty(lims,n=5)
|
||||
if(missing(mn)) mn <- min(major.ticks)
|
||||
if(missing(mx)) mx <- max(major.ticks)
|
||||
|
||||
major.ticks <- major.ticks[major.ticks >= mn & major.ticks <= mx]
|
||||
|
||||
labels <- sapply(major.ticks,function(i)
|
||||
as.expression(bquote(10^ .(i)))
|
||||
)
|
||||
axis(ax,at=major.ticks,labels=labels,...)
|
||||
|
||||
n <- n+2
|
||||
minors <- log10(pretty(10^major.ticks[1:2],n))-major.ticks[1]
|
||||
minors <- minors[-c(1,n)]
|
||||
|
||||
minor.ticks = c(outer(minors,major.ticks,`+`))
|
||||
minor.ticks <- minor.ticks[minor.ticks > mn & minor.ticks < mx]
|
||||
|
||||
|
||||
axis(ax,at=minor.ticks,tcl=par("tcl")*t.ratio,labels=FALSE)
|
||||
}
|
||||
|
||||
|
||||
x <- 10^(0:8)
|
||||
y <- 1:9
|
||||
plot(log10(x),y,xaxt="n",xlab="x",xlim=c(0,9))
|
||||
minor.ticks.axis(1,9,mn=0,mx=8)
|
Reference in New Issue
Block a user