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

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -