mohan.radhakrishnan at polarisft.com
2013-Sep-05 13:22 UTC
[R] Y-axis labels as decimal numbers
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 ?
Thanks,
Mohan
set1$duration<- as.POSIXct(paste('2013-08-24', set1$duration))
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)
# now plot you times
axis(1, at = set1$duration, labels = set1$duration, las = 2,cex.axis=2.5)
duration duration.1
2 16:03:41 0.05
3 17:03:41 0.27
4 18:03:43 1.22
5 19:03:45 1.51
6 20:03:47 1.27
7 21:03:48 1.15
8 22:03:50 1.22
9 23:03:52 1.27
10 00:03:54 1.27
11 01:03:55 1.22
12 02:03:57 1.26
13 03:03:59 1.57
14 04:04:01 1.31
15 05:04:03 1.24
This e-Mail may contain proprietary and confidential information and is sent for
the intended recipient(s) only. If by an addressing or transmission error this
mail has been misdirected to you, you are requested to delete this mail
immediately. You are also hereby notified that any use, any form of
reproduction, dissemination, copying, disclosure, modification, distribution
and/or publication of this e-mail message, contents or its attachment other than
by its intended recipient/s is strictly prohibited.
Visit us at http://www.polarisFT.com
[[alternative HTML version deleted]]
So what is wrong with the y-axis? When I run your script, things seem right. Can you explain what it is that you want. Jim Holtman Data Munger Guru What is the problem that you are trying to solve? Tell me what you want to do, not how you want to do it. On Thu, Sep 5, 2013 at 9:22 AM, <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 ? > > Thanks, > Mohan > > set1$duration<- as.POSIXct(paste('2013-08-24', set1$duration)) > 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) > # now plot you times > axis(1, at = set1$duration, labels = set1$duration, las = 2,cex.axis=2.5) > > duration duration.1 > 2 16:03:41 0.05 > 3 17:03:41 0.27 > 4 18:03:43 1.22 > 5 19:03:45 1.51 > 6 20:03:47 1.27 > 7 21:03:48 1.15 > 8 22:03:50 1.22 > 9 23:03:52 1.27 > 10 00:03:54 1.27 > 11 01:03:55 1.22 > 12 02:03:57 1.26 > 13 03:03:59 1.57 > 14 04:04:01 1.31 > 15 05:04:03 1.24 > > > This e-Mail may contain proprietary and confidential information and is sent for the intended recipient(s) only. If by an addressing or transmission error this mail has been misdirected to you, you are requested to delete this mail immediately. You are also hereby notified that any use, any form of reproduction, dissemination, copying, disclosure, modification, distribution and/or publication of this e-mail message, contents or its attachment other than by its intended recipient/s is strictly prohibited. > > Visit us at http://www.polarisFT.com > > [[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.
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
mohan.radhakrishnan at polarisft.com
2013-Sep-06 09:10 UTC
[R] Y-axis labels as decimal numbers
set1$duration<- as.POSIXct(paste('2013-08-24', set1$duration))
plot(set1$duration,as.numeric(levels(set1$duration.1)[set1$duration.1]),type="b",col
= "blue",
ylim=c(0,max(as.numeric(levels(set1$duration.1)[set1$duration.1]))),ylab="Duration",
xaxt = 'n', xlab="Time",las=2,lwd=2.5, lty=1,cex.axis=1.2)
axis(1, at = set1$duration, labels = set1$duration, las = 2,cex.axis=1.2)
text(set1$duration,as.numeric(levels(set1$duration.1)[set1$duration.1]),
as.numeric(levels(set1$duration.1)[set1$duration.1]), 2, cex=1.45)
I have used 'syntax' to use 'factors'. Works perfectly but I
still don't
know what factors are. Have been using them everywhere without
understanding :-)
Thanks,
Mohan
From: jim holtman <jholtman@gmail.com>
To: mohan.radhakrishnan@polarisft.com
Date: 09/05/2013 10:05 PM
Subject: Re: [R] Y-axis labels as decimal numbers
your x-axis appears to be incorrect because your 'duration' field
flips over midnight.
Jim Holtman
Data Munger Guru
What is the problem that you are trying to solve?
Tell me what you want to do, not how you want to do it.
On Thu, Sep 5, 2013 at 9:22 AM, <mohan.radhakrishnan@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 ?
>
> Thanks,
> Mohan
>
> set1$duration<- as.POSIXct(paste('2013-08-24', set1$duration))
> 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)
> # now plot you times
> axis(1, at = set1$duration, labels = set1$duration, las =
2,cex.axis=2.5)>
> duration duration.1
> 2 16:03:41 0.05
> 3 17:03:41 0.27
> 4 18:03:43 1.22
> 5 19:03:45 1.51
> 6 20:03:47 1.27
> 7 21:03:48 1.15
> 8 22:03:50 1.22
> 9 23:03:52 1.27
> 10 00:03:54 1.27
> 11 01:03:55 1.22
> 12 02:03:57 1.26
> 13 03:03:59 1.57
> 14 04:04:01 1.31
> 15 05:04:03 1.24
>
>
> This e-Mail may contain proprietary and confidential information and is
sent for the intended recipient(s) only. If by an addressing or
transmission error this mail has been misdirected to you, you are
requested to delete this mail immediately. You are also hereby notified
that any use, any form of reproduction, dissemination, copying,
disclosure, modification, distribution and/or publication of this e-mail
message, contents or its attachment other than by its intended recipient/s
is strictly prohibited.>
> Visit us at http://www.polarisFT.com
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help@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.
This e-Mail may contain proprietary and confidential information and is sent for
the intended recipient(s) only. If by an addressing or transmission error this
mail has been misdirected to you, you are requested to delete this mail
immediately. You are also hereby notified that any use, any form of
reproduction, dissemination, copying, disclosure, modification, distribution
and/or publication of this e-mail message, contents or its attachment other than
by its intended recipient/s is strictly prohibited.
Visit us at http://www.polarisFT.com
[[alternative HTML version deleted]]