[R] switching only axis off in plot

David Winsemius dwinsemius at comcast.net
Fri Nov 12 07:46:41 CET 2010


On Nov 12, 2010, at 12:50 AM, sachinthaka.abeywardana at allianz.com.au  
wrote:

>
> Hi R,
>
> In the following code my x-axis is formatted in month format. Which Im
> happy with. The y-axis is what I want to re-format with something  
> else.

Did you mean x-axis?

> My
> question is, is it possible just to switch off the xaxis in plot  
> function
> (see below). If not how do you get the months to show up as FEB-YYYY,
> MAR-YYYY and so on, so I could fit a label on x-axis.

axis(1, labels=toupper(format(period, format="%b-%Y")), at=period)

>
> Thanks,
> Sachin
> p.s. sorry about corporate notice.
>
> period<-c(100120,100220,100320);
> y<-1:3;
> period<-as.Date(strptime(period,("%y%m%d")));
>
> #the x-axis has a nice format with the month names
> win.graph();
> plot(period,y);
>
> #I dont want to lose this x-axis formatting :-(

Sarcasm does not translate well across text based communication.  
Please be a bit more concrete about what you want (or don't want.)

> win.graph();
> plot(period,y, axes=FALSE, ann=FALSE);
> axis(2, at=1:3, labels=c("A","B","C"));
>
> --- Please consider the environment before printing this email ---
>
> Allianz - Best General Insurance Company of the Year 2010*
> Allianz - General Insurance Company of the Year 2009+
>
> * Australian Banking and Finance Insurance Awards
> + Australia and New Zealand Insurance Industry Awards
>
> This email and any attachments has been sent by Allianz Australia  
> Insurance Limited (ABN 15 000 122 850) and is intended solely for  
> the addressee. It is confidential, may contain personal information  
> and may be subject to legal professional privilege. Unauthorised use  
> is strictly prohibited and may be unlawful. If you have received  
> this by mistake, confidentiality and any legal privilege are not  
> waived or lost and we ask that you contact the sender and delete and  
> destroy this and any other copies. In relation to any legal use you  
> may make of the contents of this email, you must ensure that you  
> comply with the Privacy Act (Cth) 1988 and you should note that the  
> contents may be subject to copyright and therefore may not be  
> reproduced, communicated or adapted without the express consent of  
> the owner of the copyright.
> Allianz will not be liable in connection with any data corruption,  
> interruption, delay, computer virus or unauthorised access or  
> amendment to the contents of this email. If this email is a  
> commercial electronic message and you would prefer not to receive  
> further commercial electronic messages from Allianz, please forward  
> a copy of this email to unsubscribe at allianz.com.au with the word  
> unsubscribe in the subject header.
>
> ______________________________________________
> 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.

David Winsemius, MD
West Hartford, CT



More information about the R-help mailing list