[R] plot options including formatting axes

P Ehlers ehlers at ucalgary.ca
Fri Nov 12 15:55:22 CET 2010


Jannis wrote:
> Hi Sachin,
> 
> please read the posting guide and include a reproducible example of what 
> you want to do.
> 
> For your first question you should have a look at ?axis. Supplying the 
> 'at' argument with the positions of the desired marks and the 'labels' 
> with text strings like '10.000$' should do what you want. There may be 
> easier ways though...
> 
> The second problem should be solved with adding your xlab and ylab 
> arguments to the call of plot() and not to title().
> 
> 
> HTH
> Jannis
> 

A couple more ideas:
1. use ann = FALSE in your plot call to omit labels
    and then add them with title(); see ?plot.default

2. use options(scipen = 3) to avoid the exponential
    format; then use format(y, big.mark = ",") to
    format your y-axis values.

   -Peter Ehlers

> sachinthaka.abeywardana at allianz.com.au schrieb:
>> Hi All,
>>
>> Currently my plot shows the y-axis in scientific notation (1e07 and so on).
>> I want to be able to display this in dollars such that it shows $10,000,000
>> (including the commas). How do I do this.
>>
>> Also with the xlabel and ylabel. I've specified: 'title('Cash vs
>> Time',xlab='Period',ylab=''); Im hoping that this will also not display
>> anything on the y-axis. Instead it is actually overwriting the default
>> x-label and the default y-label remains the same.
>>
>> Is there something I was supposed to do. I thought by specifying the 'xlab'
>> option in title it gets rid of the default one.
>>
>> Thanks,
>> Sachin
>>
>> --- 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.
>>
>>
> 
> ______________________________________________
> 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.



More information about the R-help mailing list