*Making circular dot plots. dataset close ALL. output close ALL. *********************************************************************. *Making fake data. set seed 10. input program. loop #i = 1 to 250. if #i < 210 x = TRUNC(RV.UNIFORM(0,360)). if #i >= 210 x = TRUNC(RV.UNIFORM(300,320)). end case. end loop. end file. end input program. dataset name circ. formats x (F2.0). *Regular dot plot in cartesian coordinates. GGRAPH /GRAPHDATASET NAME="graphdataset" VARIABLES=x /GRAPHSPEC SOURCE=INLINE. BEGIN GPL SOURCE: s=userSource(id("graphdataset")) DATA: x=col(source(s), name("x")) COORD: rect(dim(1)) GUIDE: axis(dim(1), label("Azimuth"), start(0), delta(1)) SCALE: linear(dim(1), min(0), max(360)) ELEMENT: point.dodge.asymmetric(position(bin.dot(x, binStart(0), binWidth(5))), size(size."10")) END GPL. *Histogram in Polar coordinates. GGRAPH /GRAPHDATASET NAME="graphdataset" VARIABLES=x /GRAPHSPEC SOURCE=INLINE. BEGIN GPL SOURCE: s=userSource(id("graphdataset")) DATA: x=col(source(s), name("x")) COORD: polar() GUIDE: axis(dim(1), label("Azimuth")) SCALE: linear(dim(1), min(0), max(360)) ELEMENT: interval(position(summary.count(bin.rect(x, binStart(0), binWidth(5)))), shape.interior(shape.square)) END GPL. *Polar with interior offset. GGRAPH /GRAPHDATASET NAME="graphdataset" VARIABLES=x /GRAPHSPEC SOURCE=INLINE. BEGIN GPL SOURCE: s=userSource(id("graphdataset")) DATA: x=col(source(s), name("x")) COORD: polar() GUIDE: axis(dim(1)) GUIDE: axis(dim(2), null()) SCALE: linear(dim(1), min(0), max(360)) SCALE: linear(dim(2), min(-4), max(20)) ELEMENT: interval(position(summary.count(bin.rect(x, binStart(0), binWidth(5)))), shape.interior(shape.square)) END GPL. *Polar coordinates - displacement of circles is not correct. GGRAPH /GRAPHDATASET NAME="graphdataset" VARIABLES=x /GRAPHSPEC SOURCE=INLINE. BEGIN GPL SOURCE: s=userSource(id("graphdataset")) DATA: x=col(source(s), name("x")) TRANS: cat=eval("B") COORD: polar() GUIDE: axis(dim(1), start(0), delta(5)) GUIDE: axis(dim(2), null()) SCALE: linear(dim(1), min(0), max(360)) SCALE: cat(dim(2), include("A","B","C")) ELEMENT: point.dodge.asymmetric(position(bin.dot(x*cat, binStart(0), binWidth(5))), size(size."10")) END GPL. *Roll my own polar coordinates. compute #bin = 5. compute #truncn = TRUNC(x/#bin). compute truncx = (#truncn*#bin) + (#bin/2). exe. sort cases by truncx. compute pol = 1. if truncx = lag(truncx) pol = lag(pol) + 1. exe. GGRAPH /GRAPHDATASET NAME="graphdataset" VARIABLES=truncx pol /GRAPHSPEC SOURCE=INLINE. BEGIN GPL SOURCE: s=userSource(id("graphdataset")) DATA: truncx=col(source(s), name("truncx")) DATA: pol=col(source(s), name("pol")) TRANS: polT=eval(pol*1.5) COORD: polar() GUIDE: axis(dim(1), null()) GUIDE: axis(dim(2), null()) SCALE: linear(dim(1), min(0), max(360)) SCALE: linear(dim(2), min(-20), max(25)) ELEMENT: point(position(truncx*polT)), size(size."8")) END GPL. *you can either play with the size of the circles - or you can transform where they lie on the second dimension. *see the TRANS statement. *Also change the inner offset *If you want a circle to represent more than one, just truncate pol. GGRAPH /GRAPHDATASET NAME="graphdataset" VARIABLES=truncx pol /GRAPHSPEC SOURCE=INLINE. BEGIN GPL SOURCE: s=userSource(id("graphdataset")) DATA: truncx=col(source(s), name("truncx")) DATA: pol=col(source(s), name("pol")) TRANS: polBin=eval(int(pol/3)*1.5) COORD: polar() GUIDE: axis(dim(1), null()) GUIDE: axis(dim(2), null()) SCALE: linear(dim(1), min(0), max(360)) SCALE: linear(dim(2), min(-20), max(25)) ELEMENT: point(position(truncx*polBin)), size(size."8")) END GPL. *This will draw multiple circles on top of one another - could be annoying or you could use to your advantage if you want. *********************************************************************. *************************************************************************************. *If you want one circle to represent multiple values, do similar to the pol value. *Can specify that non-mod values are zero - unless you want to have "partial" zeros. *************************************************************************************.