[R] clock24.plot/radial plot

Ulrik Stervbo ulrik.stervbo at gmail.com
Fri Apr 22 08:42:12 CEST 2016


I use ggplot2 for all my plotting needs where you can make plots circular
with the coord_polar. Maybe this will help you along:
http://rstudio-pubs-static.s3.amazonaws.com/3369_998f8b2d788e4a0384ae565c4280aa47.html

On Fri, 22 Apr 2016 at 08:31 Ogbos Okike <giftedlife2014 at gmail.com> wrote:

> Dear All,
> I am trying to generate a circular/radial plot. The script below has a
> result I am looking for:
> testlen<-rnorm(24)*2+5
>  testpos<-0:23+rnorm(24)/4
>  clock24.plot(testlen,testpos,main="Test Clock24 (lines)",show.grid=FALSE,
>   line.col="green",lwd=3)
>  if(dev.interactive()) par(ask=TRUE)
>  # now do a 'daylight' plot
>  oldpar<-clock24.plot(testlen[7:19],testpos[7:19],
>   main="Test Clock24 daytime (symbols)",
>   point.col="blue",rp.type="s",lwd=3)
>  # reset everything
>  par(oldpar)
>
> I tried to play with the script to work with my data. I read my data:
> swe<-scan("onedaydata",list(dates="",time="",count=""))
> dates<-swe$dates
> times<-swe$time
> count<-swe$count.
> I tried to replace testlen<-rnorm(24)*2+5 with testlen<-count and
> oldpar<-clock24.plot(testlen[7:19],testpos[7:19], with
> oldpar<-clock24.plot(testlen[0:23],testpos[0:23], but nothing worked.
> The format of my data is 2005/01/01 00:00   4009
> 2005/01/01 01:00   3969
> 2005/01/01 02:00   3946
> 2005/01/01 03:00   3975
> 2005/01/01 04:00   3960
> 2005/01/01 05:00   3974
> 2005/01/01 06:00   3971
> 2005/01/01 07:00   3970
> 2005/01/01 08:00   3962
> 2005/01/01 09:00   3992
> 2005/01/01 10:00   3955
> 2005/01/01 11:00   3963
> 2005/01/01 12:00   3965
> 2005/01/01 13:00   3947
> 2005/01/01 14:00   3959
> 2005/01/01 15:00   3978
> 2005/01/01 16:00   3967
> 2005/01/01 17:00   3978
> 2005/01/01 18:00   3988
> 2005/01/01 19:00   4043
> 2005/01/01 20:00   4026
> 2005/01/01 21:00   3996
> 2005/01/01 22:00   3967
> 2005/01/01 23:00   3969
> 2005/01/02 00:00   3976
> 2005/01/02 01:00   3969
> 2005/01/02 02:00   3955
> 2005/01/02 03:00   3984
> 2005/01/02 04:00   3971
> 2005/01/02 05:00   3960
> 2005/01/02 06:00   3951
> 2005/01/02 07:00   3948
> 2005/01/02 08:00   3954
> 2005/01/02 09:00   3948
> 2005/01/02 10:00   3960
> 2005/01/02 11:00   3964
> 2005/01/02 12:00   3962
> 2005/01/02 13:00   3959
> 2005/01/02 14:00   3950
> 2005/01/02 15:00   3972
> 2005/01/02 16:00   3984
> 2005/01/02 17:00   3983
> 2005/01/02 18:00   3982
> 2005/01/02 19:00   3987
> 2005/01/02 20:00   3989
> 2005/01/02 21:00   3975
> 2005/01/02 22:00   3956
> 2005/01/02 23:00   3975
> 2005/01/03 00:00   3946
> 2005/01/03 01:00   3944
> 2005/01/03 02:00   3915
> 2005/01/03 03:00   3901
> 2005/01/03 04:00   3893
> 2005/01/03 05:00   3854
> 2005/01/03 06:00   3824
> 2005/01/03 07:00   3790
> 2005/01/03 08:00   3770
> 2005/01/03 09:00   3794
> 2005/01/03 10:00   3778
> 2005/01/03 11:00   3803
> 2005/01/03 12:00   3801
> 2005/01/03 13:00   3800
> 2005/01/03 14:00   3783
> 2005/01/03 15:00   3789
> 2005/01/03 16:00   3804
> 2005/01/03 17:00   3781
> 2005/01/03 18:00   3785
> 2005/01/03 19:00   3772
> 2005/01/03 20:00   3777
> 2005/01/03 21:00   3766
> 2005/01/03 22:00   3775
> 2005/01/03 23:00   3779
> 2005/01/04 00:00   3798
> 2005/01/04 01:00   3806
>
> A sample of the plot I want is attached. My data is quite large.
> Thanks for your time.
> Best wishes
> Ogbos
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> 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.

	[[alternative HTML version deleted]]



More information about the R-help mailing list