[R] how to modify the tickment of x-axis

R. Michael Weylandt michael.weylandt at gmail.com
Sun Mar 18 04:11:34 CET 2012


No, the axis can be ticked anywhere you wish:

plot(1:20, xaxt = "n")
axis(1, at = seq(1, 20, by = 2), label = paste(seq(1, 20, by = 2), "h"))

Michael

On Sat, Mar 17, 2012 at 11:00 PM, Jie Tang <totangjie at gmail.com> wrote:
> I have found that  the dimension number of label must be equal with the
> dimension of the plot data by your this method.
> if we have two data in every hour,it seems can not show the correct
> tickment?
> .plot(1:20, xaxt = "n")
> axis(1, at = 1:10, label = paste(1:10, "h", sep = "")) # Happy axis!
>
>
>
> 2012/3/17 R. Michael Weylandt <michael.weylandt at gmail.com>
>>
>> Did you look at the example I gave you when you asked this question 10
>> days ago? I'll repeat for completeness
>>
>> op <- par()
>> par(ask = TRUE)
>> plot(1:10) # Unhappy axis
>>
>> plot(1:10, xaxt = "n")
>> axis(1, at = 1:10, label = paste(1:10, "h", sep = "")) # Happy axis!
>> par(ask = op$ask)
>>
>> The (good) advice to use dput() was to help us help you. Reread what was
>> said.
>>
>> Michael
>>
>> On Sat, Mar 17, 2012 at 10:22 AM, Jie Tang <totangjie at gmail.com> wrote:
>> > hi
>> >  I plot a series of observation data every minutes in a day as the
>> > attachment below
>> >
>> > plot(wnd,type='l',lty=1,col='red',lwd=1,xlab=xxlab,ylab=yylab,ylim=YY)
>> > In the figure, the x-axis tickment is the number of data   How can I
>> > change
>> > it
>> > fore example 1h 2h 3h 4h and so on ?
>> > someone has told me that use dput but it seems useless.
>> >
>> > Can anyone tell me how to use axis or at ?thank you .
>> >
>> >
>> > --
>> >> TANG Jie
>> >> Email: totangjie at gmail.com
>> >> Tel: 0086-2154896104
>> >> Shanghai Typhoon Institute,China
>> >>
>> >>
>> >>
>> >> --
>> >> TANG Jie
>> >> Email: totangjie at gmail.com
>> >> Tel: 0086-2154896104
>> >> Shanghai Typhoon Institute,China
>> >>
>> >
>> >        [[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.
>
>
>
>
> --
> TANG Jie
> Email: totangjie at gmail.com
> Tel: 0086-2154896104
> Shanghai Typhoon Institute,China



More information about the R-help mailing list