Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

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 Plot (data given above) Circular Histogram

Circular Histogram (not above data)

Rose Diagram Rose Diagram (not above data)

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

share|improve this question
2  
Surely the answers to this question from yesterday (which you have no doubt seen) address your query. mathematica.stackexchange.com/questions/31257/… –  David Carraher Aug 29 '13 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. –  Azeem Aug 29 '13 at 13:34
2  
@Azeem David is referring to the sector charts in Kuba's and Anon's answers –  rm -rf Aug 29 '13 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. –  David Carraher Aug 29 '13 at 15:16
add comment

3 Answers

Edit:

The SectorChart version is added. The SectorOrigin setting tells Mathematica that the bearings were from the North.

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}

bins = 10;
nPoints = Quotient[360, bins];
SectorChart[Thread[{ConstantArray[1, nPoints], BinCounts[data, bins]}],
 PolarAxes -> True,
 PolarTicks -> {"Direction", Automatic},
 PolarGridLines -> {Table[2 Pi k/nPoints, {k, 0, nPoints - 1}], 
   Automatic},
 SectorOrigin -> {Pi/2, "Clockwise"}]

clockwise

share|improve this answer
    
I rotated the data points by 90 degrees to account for the fact that 0 degrees was north in your data. To color in sectors I recommend SectorChart. I'll give it a try. –  David Carraher Aug 29 '13 at 16:27
    
How does it fail for those bins? Here are the grouped data by counts per bin: {5, 3, 6, 12, 10, 8, 9, 3, 0, 1, 3, 0, 0, 1, 2, 3, 4, 2, 0, 1, 0, 1, 1, 1} –  David Carraher Aug 29 '13 at 17:23
    
Please use bins=5 or 25,75,100 instead of 15. –  Azeem Aug 29 '13 at 17:39
    
Clockwise...ok, I didn't notice that. –  David Carraher Aug 29 '13 at 18:12
add comment

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
}]

enter image description here

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 - # \[Degree], {0, 0}] &;

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

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

enter image description here

share|improve this answer
    
@Kuba Could you please add v9 code for HistogramList to my answer? I mean, show how to convert it to bins as I used? –  Mr.Wizard Aug 30 '13 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 '13 at 6:25
add comment

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] := 
 Module[{hist, pts, deg2rad, angdata},
  hist = HistogramList[data, n][[2]];
  deg2rad[deg_, clock_] := 
   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]

enter image description here

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.