Thoiusand thanks to David and Don.
Great help!
 
Mario
Aachen, Germany

________________________________
Von: "MacQueen, Don" <macque...@llnl.gov>

Cc: "r-help@r-project.org" <r-help@r-project.org>; David Winsemius 
<dwinsem...@comcast.net>
Gesendet: 2:30 Donnerstag, 17.November 2011 
Betreff: Re: [R] Numerical Format on axis

To add to what David suggests, and since you're new to R, something like
this:

plot(x,y, yaxt='n')
yticks <- pretty(y)
axis(2, at=yticks, labels=sprintf("%1.2f",yticks))

See the help page for par
  ?par
and look for the entry for 'xaxt' to see what the 'yaxt' arg to plot does.

-- 
Don MacQueen

Lawrence Livermore National Laboratory
7000 East Ave., L-627
Livermore, CA 94550
925-423-1062





On 11/16/11 6:35 AM, "David Winsemius" <dwinsem...@comcast.net> wrote:

>
>On Nov 16, 2011, at 7:41 AM, Mario Giesel wrote:
>
>> Hello, list,
>>
>>  I'm new to R and I'm trying to produce a chart with currency values
>> on the y axis.
>> Values should be e.g. 1,00, 1,50, 2,00, etc.
>> In fact they are 1,0, 1,5, 2,0, etc.
>> How do I get R to show two digits after the comma on that axis?
>
>?sprintf
>?format
>
>On the left (geographic) side of the  Atlantic, it might be:
>
> > sprintf("%1.2f", 1)
>[1] "1.00"
>
>I assume that your system is set up with different options() and that
>your punkts are going to be handle to your liking by sprintf.
>
>--
>
>David Winsemius, MD
>West Hartford, CT
>
>______________________________________________
>R-help@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.



On the left (geographic) side of the  Atlantic, it might be:

> sprintf("%1.2f", 1)
[1] "1.00"

I assume that your system is set up with different options() and that your 
punkts are going to be handle to your liking by sprintf.

--

David Winsemius, MD
West Hartford, CT
        [[alternative HTML version deleted]]

______________________________________________
R-help@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.

Reply via email to