[R] Y-axis labels as decimal numbers

jim holtman jholtman at gmail.com
Fri Sep 6 16:50:08 CEST 2013


Does this modification work for you:

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)
# now plot you times
axis(1
    , at = set1$duration
    , labels = format(set1$duration, format = "%H:%M")
    , las = 2
    ,cex.axis=2.5
    )


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 Fri, Sep 6, 2013 at 1:42 AM,  <mohan.radhakrishnan at polarisft.com> wrote:
> Hi,
>
> set1$duration.2<- as.POSIXct(paste('2013-08-24', set1$duration))
> plot(set1$duration.2,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.2, labels = set1$duration, las = 2,cex.axis=2.5)
> text(set1$duration,set1$duration.1, set1$duration.1, 2, cex=1.45)
>
> I think this is the correct code. The graphs is attached. y-axis is not
> accurately shown.
>
>
>
>
> Thanks.
>
>
>
> From:        jim holtman <jholtman at gmail.com>
> To:        mohan.radhakrishnan at polarisft.com
> Cc:        R mailing list <r-help at r-project.org>
> Date:        09/05/2013 10:01 PM
> Subject:        Re: [R] Y-axis labels as decimal numbers
> ________________________________
>
>
>
> 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.
>
>
> ________________________________
> 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
> ________________________________
-------------- next part --------------
A non-text attachment was scrubbed...
Name: r-help.png
Type: image/png
Size: 7084 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20130906/cdcf587d/attachment.png>


More information about the R-help mailing list