[R] Plotting Data Frame
Petr Pikal
petr.pikal at precheza.cz
Thu Apr 27 16:41:21 CEST 2006
Hi
That is default behaviour, see the help page
pch - character string or vector of 1-characters or integers for
plotting characters, see points. The first character is the plotting-
character for the first plot, the second for the second, etc. The
default is the digits (1 through 9, 0) then the letters.
Use other options e.g. type, lty, pch if you want to modify
appearance of the matplot output. Or use matlines.
It seems to me that you are messing ts.plots and matplots. It is
always good to follow posting guide and give a small,
**reproducible** example which depicts what you did and explain how
your atempts failed. Without your data it is hard to decide what you
want and how you shall do it.
Seems to me that
plot(...., ylim=....)
for (i in 6:18) {
lines(time, data[,i])
}
could be what you want but it is only a guess.
HTH
Petr
On 27 Apr 2006 at 15:22, Ana Florencia Silbering wrote:
From: "Ana Florencia Silbering" <anafs at zedat.fu-berlin.de>
To: "'Petr Pikal'" <petr.pikal at precheza.cz>
Subject: RE: [R] Plotting Data Frame
Date sent: Thu, 27 Apr 2006 15:22:46 +0200
> Thank you very much, unfortunatelly matplot doesn´t work. I tried:
> x=c(1:13) time=matrix(x,ncol=13,nrow=1) matplot(time~data[1;6:18]) But
> this gives out an a graph with the numbers from 1 to 10 and the
> alphabet... I have tried all other options too. I think the problem is
> that the structure of the data frame. Thanks again for your time. Ana
>
> ---------------------------------------------------
> Ana Florencia Silbering
> Departament of Biology - Universität Konstanz
> Universitätsstraße 10 - M11
> D-78457 Konstanz
> Germany
>
> Tel.: (+49 7531) 88 - 4642
> Fax: (+49 7531) 88 - 3894
> email: anafs at zedat.fu-berlin.de
> ---------------------------------------------------
>
>
> -----Original Message-----
> From: Petr Pikal [mailto:petr.pikal at precheza.cz]
> Sent: Thursday, April 27, 2006 12:34 PM
> To: Ana Florencia Silbering; r-help at stat.math.ethz.ch
> Subject: Re: [R] Plotting Data Frame
>
>
> Hi
>
>
> On 27 Apr 2006 at 12:19, Ana Florencia Silbering wrote:
>
> From: "Ana Florencia Silbering"
> <anafs at zedat.fu-berlin.de>
> To: <r-help at stat.math.ethz.ch>
> Date sent: Thu, 27 Apr 2006 12:19:51 +0200
> Subject: [R] Plotting Data Frame
>
> > Dear R community members,
> > I think I am asking a very simple question, but I really looked up
> > in the faqs and manuals and found nothing helpful. I am trying to
> > plot a data frame with the following structure (this is just a small
> > extract):
> >
> > glo conc odor line series X1 X2 X3 X4 X5
> > X6
> > X7 X8 X9 X10 X11 X12 X13
> > 1 0 AIR LN1 UP -0.488 -0.242 -0.143 0.008 0.142 0.075
> > -0.031 -0.077 0.095 -0.345 -0.187 0.201 0.524
> > 2 0 AIR LN1 UP 0.482 0.209 0.448 0.338 0.295
> > 0.140
> > 0.157 -0.043 -0.341 -0.601 -0.517 -0.335 0.070
> > 5 0 AIR LN1 UP -0.294 0.214 0.409 0.048 0.198
> > -0.081
> > 0.001 -0.005 -0.136 -0.572 -0.286 0.021 -0.042
> > 7 0 AIR LN1 UP -0.488 -0.203 0.104 -0.123 0.112
> > -0.140
> > 0.049 -0.016 -0.080 -0.130 0.105 0.272 0.882
> > 1 0 AIR LN2 UP -0.643 -0.038 -0.201 -0.089 0.113
> > -0.055
> > 0.013 0.012 -0.064 -0.063 0.123 0.002 -0.099
> > 2 0 AIR LN2 UP -0.510 0.364 0.619 0.565 0.634
> > 0.167
> > 0.209 -0.300 -0.615 -0.528 -0.400 -0.623 -0.312
> > 5 0 AIR LN2 UP 0.350 0.737 0.183 0.563 0.406
> > 0.169
> > -0.155 -0.189 0.036 0.051 0.297 0.014 -0.380
> > 7 0 AIR LN2 UP -0.450 -0.234 -0.526 -0.587 -0.068
> > -0.187
> > 0.124 0.070 0.141 0.159 0.356 0.505 0.648
> >
> > Where the first 5 columns (glo, conc, odor, line, series) are
> > different categorizing factors and the rest are values of a variable
> > over time. I would like to plot the values of the independent
> > variable
>
> > over time with one line for each of the groups defined by the
> > categorical factors. I have tried something like extracting the time
> > series for a particular group with, for example data[1,6:18] and
> > plotting that against a vector time=c(1:13), but that does not
> > work.
>
> Did you want
>
> matplot(time,data[,6:18])
>
> or maybe combination plot and lines
> or maybe xyplot from lattice package.
>
> HTH
> Petr
>
>
>
> > Is there any way of making such a plot or should I rearrange the
> > data so that time is also a factor specified by a column?
> >
> > Thank you very much in advance.
> > Ana
> > ---------------------------------------------------
> > Ana Florencia Silbering
> > Departament of Biology - Universität Konstanz Universitätsstraße 10
> > - M11 D-78457 Konstanz Germany
> >
> > Tel.: (+49 7531) 88 - 4642
> > Fax: (+49 7531) 88 - 3894
> > email: anafs at zedat.fu-berlin.de
> > ---------------------------------------------------
> >
> >
> > [[alternative HTML version deleted]]
> >
> >
>
> Petr Pikal
> petr.pikal at precheza.cz
>
>
Petr Pikal
petr.pikal at precheza.cz
More information about the R-help
mailing list