[R] default plot, but stripes appear (and other plot problems)

David Winsemius dwinsemius at comcast.net
Sat May 19 21:20:31 CEST 2012


On May 19, 2012, at 12:36 PM, bets wrote:

> Sorry, I hoped this was already clear enough.

Below you offer two examples of console output without naming the  
objects from which they came or the code you are attempting to us.  
(Also in the all-to-typical manner of those posting through Nabble  
youexpect us to refer to early postings rather than including context.  
Presumably you are making implicit reference to an effort to using  
this code:

plot(ID, settlepw$T.local, type="l",ylab="Temperature(°C)", xlab="")
>
> Oké, here are the first rows of the relevant part of the data:
>
> Datum	      week        	T.local
> 29/06/11	1	        19.272420
> 5/07/11	        2	        19.305034
> 13/07/11	3	        17.766046
> 20/07/11	4	        17.394985
> 27/07/11	5	        19.520233
> 3/08/11	        6	        18.528367

There is no "ID" variable, so that coe should fail. If the goal were  
to use that first columns as a Date field then you would need to  
convert it to a date class.

settlepw$ID <- as.Date(settlepw$Datum, "%y/%m/%d")


>
> And this is for the second graph:
>
> day	   datum	      T.regional
> 1	   23-mrt-11	   15.59
> 2	   24-mrt-11	   15.52
> 3	   25-mrt-11	   15.51
> 4	   26-mrt-11	   15.54
> 5	   27-mrt-11	   15.60
> 6	   28-mrt-11	   15.23
> 7	   29-mrt-11	   15.23
> 8	   30-mrt-11	   15.22
> 9	   31-mrt-11	   15.77
> 10	   01-apr-11	   16.23
>

plot(day, hatch$T.local, type="l", ylab="", ylim=c(15,25), xlab=" ")

That one may require that you present an appropriate vector of month  
abbreviations for you language. I am a langauge weenie and only have  
English and a bit of German in my repetoire. My installation of R only  
has the built-in variable:

  month.abb
  [1] "Jan" "Feb" "Mar" "Apr" "May" "Jun" "Jul" "Aug" "Sep" "Oct"  
"Nov" "Dec"

Maybe there is a format that will do what you need. See:

?strptime

Reading that help page suggests there may be support for locale- 
specific abbreviations, so you could try:

hatch$day2 <- as.Date(hatch$datum, "%d-%b-%y")

>

--


David Winsemius, MD
West Hartford, CT



More information about the R-help mailing list