r - How do I set what plot() labels the x-axis with? -
i have plot() i'm trying make, not want x-values used axis labels...i want different character vector want use labels, in standard way: use many fit, drop others, etc. should pass plot() make happen?
for example, consider
d <- data.frame(x=1:5,y=10:15,x.names=c('a','b','c','d','e'))
in barplot, pass barplot(height=d$y,names.arg=d$x.names)
, in case actual x-values important. analog such plot(x=d$x,y=d$y,type='l',names.arg=d$x.names)
, not work.
i think want first suppress labels on x axis xaxt="n" option:
plot(flow~factor(month),xlab="month",ylab="total flow per month",ylim=c(0,55000), xaxt="n")
then use axis command add in own labels. example assumes labels in object called month.name
axis(1, at=1:12, labels=month.name)
i had how , i stole example here.
Comments
Post a Comment