# Circular Plot and Circular Histogram

The spherical or circular data arises when we measure data in degree e.g wind direction, clock and compass etc. Then representation of such data we need to plot circular plot, circular histogram and rose diagram. How to plot this data? for example we have data

data={8,9,13,13,14,18,22,27,30,34,38,38,40,44,45,47,48,48,48,48,50,53,56,57,58,58,61,63,
64,64,64,65,65,68,70,73,78,78,78,83,83,88,88,88,90,92,92,93,95,96,98,100,103,106,113,118,138,
153,153,155,204,215,223,226,237,238,243,244,250,251,257,268,285,319,343,350}


These are the 76 directions measured in degree clockwise from north. The specimen of circular plot, circular histogram and rose diagram are given below

Circular Plot (data given above)

Circular Histogram (not above data)

Rose Diagram (not above data)

Note: Any appropriate interval is to be taken for circular histogram from the given data.

• Surely the answers to this question from yesterday (which you have no doubt seen) address your query. mathematica.stackexchange.com/questions/31257/… Aug 29, 2013 at 13:15
• @DavidCarraher: I see your refer Q&A, also I follow it tomorrow too specially your answer. But Dont see any similarity of wind rose with circular plot, infect these observations are angels should be on the circumstances of the circle with respective angle.
– SAAN
Aug 29, 2013 at 13:34
• @Azeem David is referring to the sector charts in Kuba's and Anon's answers
– rm -rf
Aug 29, 2013 at 15:03
• ListPolarPlot allows for inputs as ordered pairs consisting of (angle, value). You could Tally by angle or do BinCount s by angle intervals. The output can be displayed in various ways. You could do the same with SectorChart but would need to massage the data more than with ListPolarPlot. Aug 29, 2013 at 15:16

The function f takes as arguments the raw, unbinned data, the number of sectors, and a boolean parameter to indicate whether polar gridlines are to be drawn.

data = {8, 9, 13, 13, 14, 18, 22, 27, 30, 34, 38, 38, 40, 44, 45, 47, 48, 48, 48, 48, 50, 53, 56, 57, 58, 58, 61, 63, 64, 64, 64, 65, 65, 68, 70, 73, 78, 78, 78, 83, 83, 88, 88, 88, 90, 92, 92, 93, 95, 96, 98, 100, 103, 106, 113, 118, 138, 153, 153, 155, 204, 215, 223, 226,237, 238, 243, 244, 250, 251, 257, 268, 285, 319, 343, 350}

f[dat_,nSectors_,polarGridLinesQ_]:=Module[{binwidth=360/nSectors},
PolarAxes->If[polarGridLinesQ,{True,True},{False,True}],
PolarTicks->{If[polarGridLinesQ,"Degrees",None],Automatic},
PolarGridLines->If[polarGridLinesQ,{Table[2Pi k/nSectors+Pi/4,{k,1,nSectors}],Automatic},{None,None}],
SectorOrigin->{Pi/2,"Clockwise"}]]


With 5 sectors

GraphicsGrid[{{f[data, 5, True], f[data, 5, False]}}, ImageSize -> Large]


With 25 sectors

GraphicsGrid[{{f[data, 25, True], f[data, 25, False]}}, ImageSize -> Large]


– SAAN
Aug 29, 2013 at 17:39
• I used 5 and 25 bins (i.e. sectors) as examples. Sep 10, 2015 at 0:57

Here's my contribution for the first type of chart:

bins = Tally @ Ceiling[data, 5];

labelfn = Text[HoldForm[# °], 8 {Sin[# °], Cos[# °]}] &;

ptfn = Rotate[Point @ Thread @ {10 + Range@#2, 0}, Pi/2 - # °, {0, 0}] &;

linefn = Rotate[Line[{{9.5, 0}, {10, 0}}], Pi/2 - # °, {0, 0}] &;

Graphics[{
Circle[{0, 0}, 10],
labelfn /@ {0, 90, 180, 270},
linefn /@ Range[0, 355, 5],
PointSize[0.02],
ptfn @@@ bins
}]


Sizes are hard-coded which is never the best, but it's a start.

I don't have HistogramList is v7 so I used Tally for brevity.

Kuba's V9 edit:

bins = {MovingAverage[#, 2], #2} & @@ HistogramList[data, {0, 360, 3.1}] // Transpose;
ptfn = Rotate[Point@Thread@{10 + Range@#2, 0}, Pi/2 - # °, {0, 0}] &;

linefn = Rotate[Line[{{9.5, 0}, {10, 0}}], Pi/2 - # °, {0, 0}] &;

Graphics[{Circle[{0, 0}, 10],
labelfn /@ {0, 90, 180, 270},
linefn /@ Range[0, 355, 10],
PointSize[0.02], ptfn @@@ bins
}]


• @Kuba Could you please add v9 code for HistogramList to my answer? I mean, show how to convert it to bins as I used? Aug 30, 2013 at 5:07
• I couldn't find the best width for bins and it does not reproduce exactly the same graph as in the question. Moreover i think there is something missing in your Tally method, take a look at 350-10 interval.
– Kuba
Aug 30, 2013 at 6:25

Here's my take at replicating your circular plot. To get the ticks right isn't as easy as one might think, there is no option to put the ticks on the inside of the circle. The ticks will have to be produced manually...

CircularDotHistogram[data_, n_, clockwise_: True] :=
hist = HistogramList[data, n][[2]];
If[clock, (5/2) Pi - (2 Pi/n) deg, (2 Pi/n) deg];
pts[maxval_, {degree_}] := {deg2rad[ degree, True], 10 + #} & /@
Range[maxval];
angdata = MapIndexed[pts, hist];
ListPolarPlot[angdata,
PlotMarkers -> Graphics[{Black, PointSize[Large], Point[{0, 0}]}],
Axes -> False,
PolarTicks -> None,
PolarAxes -> {True, False},
PolarGridLines -> False,
PolarAxesOrigin -> {Pi, 10}
]
]
CircularDotHistogram[data, 72, True]