[R] Plot

Petr PIKAL petr.pikal at precheza.cz
Tue Oct 6 17:03:50 CEST 2009


Hi

beside other options if you do not want to learn how to order factor 
levels

Days <- c("Monday", "Tuesday", "Wed", "Thu", "Fri", "Sat","Sun")
Hum <-c(56,57,60,75,62,67,70)
Temp<-c(76,77,81,95,82,77,83)

> limits<-range(c(Hum, Temp))
> limits
[1] 56 95
> plot(1:7, Hum, ylim=limits)
> points(1:7, Temp, col=2)
> plot(1:7, Hum, ylim=limits, axes=F)
> points(1:7, Temp, col=2)
> axis(1, at=1:7, Days)
> axis(2)
> box()
>

this may work for you if you get rid of unnecessary matrix call.

Regards
Petr


r-help-bounces at r-project.org napsal dne 06.10.2009 16:35:44:

> Thanks Sara,
> 
> Yes I did try. I could not get the Days on the X-axis
> 
> blow is theerror message
> 
> plot(Temp,Days)
> Error in plot.window(...) : need finite 'ylim' values
> In addition: Warning messages:
> 1: In xy.coords(x, y, xlabel, ylabel, log) : NAs introduced by coercion
> 2: In min(x) : no non-missing arguments to min; returning Inf
> 3: In max(x) : no non-missing arguments to max; returning -Inf
> >
> 
> 
> 
> On Tue, Oct 6, 2009 at 10:19 AM, Sarah Goslee 
<sarah.goslee at gmail.com>wrote:
> 
> > Did you try it? With, perhaps, plot() ? And lines() ?
> >
> > You might do better with Days as a factor with the day names in order. 
(And
> > why are two full and five abbreviated?)
> >
> > I don't understand why Hum and Temp are matrices rather than vectors,
> > and why then you didn't specify dimensions, and for that matter why 
you
> > are missing a closing paren but do have a comma in its place.
> >
> > Generally this list is happy to help, but we like some evidence that 
the
> > querent has *tried* before inquiring.
> >
> > Sarah
> >
> > On Tue, Oct 6, 2009 at 10:05 AM, Ashta <sewashm at gmail.com> wrote:
> > > Hi All,
> > >
> > >
> > > Days <- matrix(c("Monday", "Tuesday", "Wed", "Thu", "Fri", "Sat",
> > > "Sun"),7,1)
> > >
> > > Hum <-matrix(c(56,57,60,75,62,67,70),
> > >
> > > Temp<-matrix(c(76,77,81,95,82,77,83),
> > >
> > >
> > >
> > > Using the above information I want plot humidity and temperature on
> > Y-axis
> > > and days on X-axis
> > >
> > > Any help is appreciated!
> > >
> >
> > --
> > Sarah Goslee
> > http://www.functionaldiversity.org
> >
> 
>    [[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