Skip to main content
Corrected bin definition and added sector reordering.
Source Link
MikeLimaOscar
  • 3.5k
  • 19
  • 30

[Edited to correct the bin definition.]

You could use SectorChart. The trick is to ensure that your bin widths sum to 360° and that the first bin charted starts at zero.

Firstly, and borrowing shamelessly from @george2079's answer [and subsequent correction], define the bins:

bins = Table[a , {a, 0-180, 360180, 30}]; 

Next create the sector chart data:

sData = Transpose[RotateLeft[ Tooltip[Join[Differences[#1], {(-1)#2}], Subtract{Mean[#1], #2}] & @@@  Transpose[{Partition[bins, 2, 1], BinCounts[angles, {bins}]}], FirstPosition[bins, 0] - 1] 

{{30, 301}, {30, 608}, {30, 240}, {30, 240}, {30, 72}, {30, 61}, {30, 00},    {30, 01}, {30, 0}, {30, 0}, {30, 01}, {30, 0}}

ThenThere are several things going on here:

  • We add a tooltip so that the each sector is labelled with the mid-point of the bin and the count,
  • we calculate the width of each bin and
  • we rotate the data such that the bin starting at zero is first in the list. Obviously this requires a bin edge at zero.

Finally chart it, adding axes, etc. and rotating the origin (thanks again @george2079):

SectorChart[sData, PolarGridLines -> Automatic, PolarTicks -> {Automatic, None}, PolarAxes -> True]{True, False}, SectorOrigin -> 0] 

SectorChartSector chart

You could use SectorChart. The trick is to ensure that your bin widths sum to 360°.

Firstly, and borrowing shamelessly from @george2079's answer, define the bins:

bins = Table[a , {a, 0, 360, 30}]; 

Next create the sector chart data:

sData = Transpose[{(-1) Subtract @@@ Partition[bins, 2, 1], BinCounts[angles, {bins}]}] 

{{30, 30}, {30, 60}, {30, 24}, {30, 24}, {30, 7}, {30, 6}, {30, 0},  {30, 0}, {30, 0}, {30, 0}, {30, 0}, {30, 0}}

Then chart it, adding axes, etc.:

SectorChart[sData, PolarGridLines -> Automatic, PolarTicks -> {Automatic, None}, PolarAxes -> True] 

SectorChart

[Edited to correct the bin definition.]

You could use SectorChart. The trick is to ensure that your bin widths sum to 360° and that the first bin charted starts at zero.

Firstly, and borrowing shamelessly from @george2079's answer [and subsequent correction], define the bins:

bins = Table[a , {a, -180, 180, 30}]; 

Next create the sector chart data:

sData = RotateLeft[ Tooltip[Join[Differences[#1], {#2}], {Mean[#1], #2}] & @@@  Transpose[{Partition[bins, 2, 1], BinCounts[angles, {bins}]}], FirstPosition[bins, 0] - 1] 

{{30, 1}, {30, 8}, {30, 0}, {30, 0}, {30, 2}, {30, 1}, {30, 0},  {30, 1}, {30, 0}, {30, 0}, {30, 1}, {30, 0}}

There are several things going on here:

  • We add a tooltip so that the each sector is labelled with the mid-point of the bin and the count,
  • we calculate the width of each bin and
  • we rotate the data such that the bin starting at zero is first in the list. Obviously this requires a bin edge at zero.

Finally chart it, adding axes, etc. and rotating the origin (thanks again @george2079):

SectorChart[sData, PolarGridLines -> Automatic, PolarTicks -> {Automatic, None}, PolarAxes -> {True, False}, SectorOrigin -> 0] 

Sector chart

Source Link
MikeLimaOscar
  • 3.5k
  • 19
  • 30

You could use SectorChart. The trick is to ensure that your bin widths sum to 360°.

Firstly, and borrowing shamelessly from @george2079's answer, define the bins:

bins = Table[a , {a, 0, 360, 30}]; 

Next create the sector chart data:

sData = Transpose[{(-1) Subtract @@@ Partition[bins, 2, 1], BinCounts[angles, {bins}]}] 

{{30, 30}, {30, 60}, {30, 24}, {30, 24}, {30, 7}, {30, 6}, {30, 0}, {30, 0}, {30, 0}, {30, 0}, {30, 0}, {30, 0}}

Then chart it, adding axes, etc.:

SectorChart[sData, PolarGridLines -> Automatic, PolarTicks -> {Automatic, None}, PolarAxes -> True] 

SectorChart