Set tck to vector of values in R -


i wanting set tick marks on x axis of plot change length (from 0.015 0.02) every 5th tick position, tck won't accept more 1 value, ideas? here example of code:

year<-seq(1960,2010,1)  xlab.pos <- rep (na, length (year)) xlab.pos [seq(1, length (xlab.pos), 5)] <- year [seq(1, length (year), 5)]  xlab.tck <- rep(0.015, length (year)) xlab.tck [seq(1, length (xlab.tck), 5)] <- 0.02  plot(0, 0, type = "n", xlab = "", ylab = "", xaxt = "n", xlim = c(min(year), max(year)),ylim = c(0, 5000))  axis(1, @ = seq(min(year),max(year),1), labels = xlab.pos, tck = xlab.tck) 

but expected error: graphical parameter "tck" has wrong length can't figure out how set otherwise.

using package hmisc out.

library(hmisc) plot(0, 0, type = "n", xlab = "", ylab = "", xaxt = "n",      xlim = c(min(year), max(year)),ylim = c(0, 5000)) axis(1, @ = seq(min(year),max(year),1), labels = xlab.pos, tck = -0.015) minor.tick(nx = 3, ny = 0, tick.ratio = -1/2) 

you'll need bit of tweaking though!


Comments

Popular posts from this blog

Unable to remove the www from url on https using .htaccess -