I'm having a problem with plotting time series data if I want to zoom in a certain time frame within the entire x domain (time axis). See the following code for context:
date_time <- as.factor(c('8/24/07 17:30','8/24/07 18:00','8/24/07 18:30',
'8/24/07 19:00','8/24/07 19:30','8/24/07 20:00',
'8/24/07 20:30','8/24/07 21:00','8/24/07 21:30',
'8/24/07 22:00','8/24/07 22:30','8/24/07 23:00',
'8/24/07 23:30','8/25/07 00:00','8/25/07 00:30'))
U. <- as.factor(c('0.2355','0.2602','0.2039','0.2571','0.1419','0.0778','0.3557',
'0.3065','0.1559','0.0943','0.1519','0.1498','0.1574','0.1929','0.1407'))
dts<-strptime(as.character(date_time),'%m/%d/%y %H:%M')
plot(dts,as.numeric(U.),xlim=c('2007-08-24 17:30:00','2007-08-24 19:00:00'))
My question: Why doesn't xlim work in this case and how to fix it? Please help.
Note: ignore as.factor
and as.numeric
, I added these to mimic the actual data once I import it into R