[R] x-axis plot problem

Rolf Turner r.turner at auckland.ac.nz
Sun Feb 7 22:02:14 CET 2010


I think you just need to set axes=FALSE in your call to matplot().
You'll then need to add the y-axis manually --- do axis(2) in
addition to your call which draws the x axis.

You'll also need to do box() if you want a box around your graph.

	cheers,

		Rolf Turner

P. S. You are clearly a Good Person!  A relative newbie who has
read the Posting Guide! :-)

		R. T.

On 8/02/2010, at 9:22 AM, abotaha wrote:

> 
> Hi all, 
> I tried to have plot of many vector in one plot and i have got a nice plot
> but i have problem with x-axis. I want to have month and year only(Jul.07
> means July 2007) in x-axis without appearing other number behaind it. 
> 
> I would appercit any help.
> 
> The R code:
> 
> F<-c(7.49,6.91,6.78,6.99,7.44,7.42)
> M<-c(4.81,4.51,5.21,4.65,4.75,3.86)
> P<-c(7.49,15.03,15.19,15.32,15.42,15.45)
> B<-c(16.24,15.87,12.94,11.82,10.86,9.61)
> 
> time<-c("Jul/07","Aug/07","Sep/07","Oct/07","Nov/07","Dec/07")
> model<-data.frame(F,M,P,B)
> row.names(model)<-c("Jul07","Aug07","Sep07","Oct07","Nov07","Dec007")
> model
> 
> par(mgp=c(2, 1, 0),bty="o" )
> matplot(model, pch = c(1,22,17,16), type = "o",lty=c(2,2,2,5), col
> =c("gray10"," gray10","gray10","gray10"),xlab="Month-Year",ylab="Zinth",
> xaxs = "i", yaxs = "i",main="Model Output")
> legend("topleft", legend = c("F", "M","P","B"),text.width =
> strwidth("1,000,000,"),pch=c(1,22,17,16),col =c("gray10","
> gray10","gray10","gray10"),lty=c(2,2,2,5), xjust = 1, yjust = 1, bty="n",
> cex=0.8, ncol=2)
> 

> -- 
> View this message in context: http://n4.nabble.com/x-axis-plot-problem-tp1472286p1472286.html
> Sent from the R help mailing list archive at Nabble.com.
> 
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

######################################################################
Attention: 
This e-mail message is privileged and confidential. If you are not the 
intended recipient please delete the message and notify the sender. 
Any views or opinions presented are solely those of the author.

This e-mail has been scanned and cleared by MailMarshal 
www.marshalsoftware.com
######################################################################



More information about the R-help mailing list