[R] Y-axis labels as decimal numbers
Jim Lemon
jim at bitwrit.com.au
Thu Sep 5 23:05:02 CEST 2013
On 09/05/2013 11:22 PM, mohan.radhakrishnan at polarisft.com wrote:
> Hi,
> I am able to create a graph with this code but the decimal
> numbers are not plotted accurately because the ylim values are not set
> properly. x-axis is proper.
>
> How do I accurately set the ylim for duration.1 column ?
Hi Mohan,
I think you may have your axes mixed up. Try this and see:
set1<-read.table(text="duration duration.1
16:03:41 0.05
17:03:41 0.27
18:03:43 1.22
19:03:45 1.51
20:03:47 1.27
21:03:48 1.15
22:03:50 1.22
23:03:52 1.27
00:03:54 1.27
01:03:55 1.22
02:03:57 1.26
03:03:59 1.57
04:04:01 1.31
05:04:03 1.24",header=TRUE)
set1$duration<- as.POSIXct(paste(c(rep('2013-08-24',8),rep('2013-08-25',6)),
set1$duration))
par(mar=c(10,4,4,2))
plot(set1$duration,set1$duration.1,type="b",col="blue",ylab="",xaxt='n',
xlab="",las=2,lwd=2.5,lty=1,cex.axis=2.5)
axis(1, at = set1$duration, labels = set1$duration, las = 2,cex.axis=1)
par(mar=c(5,4,4,2))
Jim
More information about the R-help
mailing list