[R] R - PLOT - X-AXIS - DECIMALS

PIKAL Petr petr.pikal at precheza.cz
Thu Nov 20 09:08:16 CET 2014


Hi

Plot calls function pretty which calculates values for annotating axes.

You can get rid of this behaviour by

plot(..., axes=FALSE)

and calling
axis(1, ...)

see

?plot
?pretty
?axis

Cheers
Petr


> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-
> project.org] On Behalf Of statup r
> Sent: Thursday, November 20, 2014 7:33 AM
> To: MacQueen, Don
> Cc: r-help
> Subject: Re: [R] R - PLOT - X-AXIS - DECIMALS
>
> this got fixed when I added 3 more rows to my existing test.csv file,
> i.e.
> new file got below data, with additional 3 rows:
>
>    year   sale
>     2001  100
>     2002  200
>     2003  300
>     2004  400
>     2005  500
>
> What's the secret behind 5 rows , i mean is there any link between plot
> chart and 5 values ?
> If I use less than 5 rows, it's breaking x-axis values into 5 decimals
> !!!
>
> Hope you understood what I've told, if not, let me know...will provide
> you
> reproducible steps.
>
> Many Thanks.
>
>
>
>
>
> On Thu, Nov 20, 2014 at 2:55 AM, MacQueen, Don <macqueen1 at llnl.gov>
> wrote:
>
> > My guess is that perhaps
> >   plot(aaa$year, aaa$sale)
> > will produce something closer to what was expected.
> >
> > --
> > Don MacQueen
> >
> > Lawrence Livermore National Laboratory
> > 7000 East Ave., L-627
> > Livermore, CA 94550
> > 925-423-1062
> >
> >
> >
> >
> >
> > On 11/19/14, 8:26 AM, "Sarah Goslee" <sarah.goslee at gmail.com> wrote:
> >
> > >Hi,
> > >
> > >Since you didn't provide a reproducible example, we have no way of
> > >knowing.
> > >
> > http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-
> reproduci
> > >ble-example
> > >
> > >But if I were you, I'd start with
> > >str(aaa)
> > >because my first guess is that your data import did not work as you
> > >expected.
> > >
> > >
> > >
> > >On Wed, Nov 19, 2014 at 10:13 AM, statup r <statup.r at gmail.com>
> wrote:
> > >> I have a test.csv with two fields "year" and "sale", with below
> values:
> > >>
> > >> year   sale
> > >> 2001    1002002    200
> > >
> > >That looks like three fields to me.
> > >This may be an example of why you SHOULDN'T post to the list in
> HTML.
> > >
> > >
> > >> This is what I did in R.
> > >>
> > >>>aaa<-read.csv("test.csv")
> > >>
> > >>>plot(aaa)
> > >>
> > >>
> > >> But when I call the above plot function why I'm getting decimals
> in
> > >>x-axis
> > >> (year) ex: 2001.0, 2002.05
> > >>
> > >> Please help.
> > >>
> > >>         [[alternative HTML version deleted]]
> > >>
> > >
> > >--
> > >Sarah Goslee
> > >http://www.functionaldiversity.org
> > >
> > >______________________________________________
> > >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.
> >
> >
>
>       [[alternative HTML version deleted]]
>
> ______________________________________________
> 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.

________________________________
Tento e-mail a jakékoliv k němu připojené dokumenty jsou důvěrné a jsou určeny pouze jeho adresátům.
Jestliže jste obdržel(a) tento e-mail omylem, informujte laskavě neprodleně jeho odesílatele. Obsah tohoto emailu i s přílohami a jeho kopie vymažte ze svého systému.
Nejste-li zamýšleným adresátem tohoto emailu, nejste oprávněni tento email jakkoliv užívat, rozšiřovat, kopírovat či zveřejňovat.
Odesílatel e-mailu neodpovídá za eventuální škodu způsobenou modifikacemi či zpožděním přenosu e-mailu.

V případě, že je tento e-mail součástí obchodního jednání:
- vyhrazuje si odesílatel právo ukončit kdykoliv jednání o uzavření smlouvy, a to z jakéhokoliv důvodu i bez uvedení důvodu.
- a obsahuje-li nabídku, je adresát oprávněn nabídku bezodkladně přijmout; Odesílatel tohoto e-mailu (nabídky) vylučuje přijetí nabídky ze strany příjemce s dodatkem či odchylkou.
- trvá odesílatel na tom, že příslušná smlouva je uzavřena teprve výslovným dosažením shody na všech jejích náležitostech.
- odesílatel tohoto emailu informuje, že není oprávněn uzavírat za společnost žádné smlouvy s výjimkou případů, kdy k tomu byl písemně zmocněn nebo písemně pověřen a takové pověření nebo plná moc byly adresátovi tohoto emailu případně osobě, kterou adresát zastupuje, předloženy nebo jejich existence je adresátovi či osobě jím zastoupené známá.

This e-mail and any documents attached to it may be confidential and are intended only for its intended recipients.
If you received this e-mail by mistake, please immediately inform its sender. Delete the contents of this e-mail with all attachments and its copies from your system.
If you are not the intended recipient of this e-mail, you are not authorized to use, disseminate, copy or disclose this e-mail in any manner.
The sender of this e-mail shall not be liable for any possible damage caused by modifications of the e-mail or by delay with transfer of the email.

In case that this e-mail forms part of business dealings:
- the sender reserves the right to end negotiations about entering into a contract in any time, for any reason, and without stating any reasoning.
- if the e-mail contains an offer, the recipient is entitled to immediately accept such offer; The sender of this e-mail (offer) excludes any acceptance of the offer on the part of the recipient containing any amendment or variation.
- the sender insists on that the respective contract is concluded only upon an express mutual agreement on all its aspects.
- the sender of this e-mail informs that he/she is not authorized to enter into any contracts on behalf of the company except for cases in which he/she is expressly authorized to do so in writing, and such authorization or power of attorney is submitted to the recipient or the person represented by the recipient, or the existence of such authorization is known to the recipient of the person represented by the recipient.


More information about the R-help mailing list