[R] Why horizontal bars instead of a line
Schreiber, Stefan
Stefan.Schreiber at ales.ualberta.ca
Wed Sep 24 20:30:30 CEST 2008
Hey Greg!
Thank you very much for your detailed response!!
I really appreciate that!
Yeah, you're right! The axis labels are the way to go ... I was so
focused on getting rid of the bars, that I didn't even think about
that.
Sorry for bothering the list about that!
Stefan
-----Original Message-----
From: Greg Snow [mailto:Greg.Snow at imail.org]
Sent: Wednesday, September 24, 2008 12:06 PM
To: Schreiber, Stefan; r-help at r-project.org
Subject: RE: Why horizontal bars instead of a line
Remember that computers are not as smart as you. Some smart people have
written instructions for the computer on what to do in certain cases,
but they can't anticipate everything, so when you tell the computer to
do something that was different from what is anticipated, it either
gives an error or the results of a wrong guess.
In your case, since GrSe has a G in the front and your data is probably
in a data frame, the plot function sees a factor (generally what gets
created automatically when characters are seen) and passes the data to
plot.factor which plots boxplots (and with 1 point per year, the 5
number summary for the boxplot gives all the same value, hence the
horizontal line).
What you probably want to do is to plot your clone data against a
numerical representation of the year (without the G), but suppress the
axis labels and add the labels yourself (with the G), see ?axis for
detail on doing this.
Hope this helps,
--
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.snow at imail.org
801.408.8111
> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-
> project.org] On Behalf Of Schreiber, Stefan
> Sent: Wednesday, September 24, 2008 9:28 AM
> To: r-help at r-project.org
> Subject: [R] Why horizontal bars instead of a line
>
> Hey list!
>
>
> It looks simple, though it's not possible for me to plot the following
> properly:
>
> (some made-up data)
>
> GrSe Clone1 Clone2 Clone3 Clone4 Clone...
> G1999 2 3 6 5
> G2000 2 5 7 4
> G2001 5 3 7 3
> G2002 4 5 8 3
> G...
>
>
>
> GrSe=Growing Season.
>
> I've read the file as "x" and then tried: plot(x$GrSe,x$Clone1)
>
> The output is 4 horizontal bars. Even if I write
> plot(x$GrSe,x$Clone1,type="n") R is still plotting!
> I figured already that if I delete the "G" in front of the years it'll
> work, however, I'd like to keep the "G".
> Is that possible?
>
> Hope it is an appropriate question for the list.
>
> Thanks,
> Stefan
>
>
>
>
> [[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.
More information about the R-help
mailing list