[R] Plot

joris meys jorismeys at gmail.com
Tue Oct 6 16:44:45 CEST 2009


Actually, it's a bit more complex than just plot(). First you have to
make Days an ordered factor, otherwise you get indeed that error.

days <- c("Mon", "Tue", "Wed", "Thu", "Fri", "Sat","Sun")
Days <- factor(days,levels=days,ordered=T)

Then you want to make a plot with 2 axes, you should check :
http://wiki.r-project.org/rwiki/doku.php?id=tips:graphics-base:2yaxes

and reconsider...

Kind regards

On Tue, Oct 6, 2009 at 4:19 PM, 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
>
> ______________________________________________
> 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