0

Building up on From Cartesian Plot to Polar Histogram using Mathematica I would like to customize the R and theta Axes :

please consider :

list = {{21, 16}, {16, 14}, {11, 11}, {11, 12}, {13, 15}, {18,17}, {19, 11}, {17, 16}, {16, 19}}

Module[{Countz, maxScale, angleDivisions, dAng}, 
        maxScale = 4;
        angleDivisions = 12;
        dAng = (2 \[Pi])/angleDivisions;
        Countz = BinCounts[ Flatten@Map[ArcTan @@ (# - ScreenCenter) &, list, {1}], 
                            {-Pi, Pi,dAng}];

        SectorChart[{ConstantArray[1, Length[Countz]], Countz}\[Transpose], 
        SectorOrigin -> {-\[Pi]/angleDivisions, "Counterclockwise"}, 
        PolarAxes -> True, PolarGridLines -> {Automatic, {1, 2, 3, 4, 5}},
        PolarAxesOrigin -> {Pi/2, 5},
        PolarTicks -> {Table[{i \[Degree] + \[Pi]/angleDivisions, i \[Degree]}, 
                       {i, 0, 345, 30}], Range[5]}, 
        ChartStyle -> {Directive[EdgeForm[{Black, Thickness[0.005]}], Red]},
        BaseStyle -> {FontFamily -> "Arial", FontWeight -> Bold, 
        FontSize -> 12}, ImageSize -> 400, 
        ChartElementFunction -> Function[{range}, 
                                Disk[{0, 0}, range[[2, 2]], -11 Pi/12 + range[[1]]]]]]

enter image description here

2/I would like to add one "theta bar" colored at 45 Degree (as shown in the image). However I did that using ppt. I could not find a mean to keep the Table to get the main theta axes and draw another one colored differently.

enter image description here

3/I failed to adapt the solution provided on Customsize Backgroud in Plot within Mathematica to a Polarplot using Prolog. Is it possible to have the area within the outer circle of the plot colored in Gray let`s say ?

Community
  • 1
  • 1
500
  • 6,509
  • 8
  • 46
  • 80

1 Answers1

3

You could use Epilog to create the line and Prolog for the background, e.g.

Module[{Countz, maxScale, angleDivisions, dAng}, maxScale = 4;
 angleDivisions = 12;
 dAng = (2 \[Pi])/angleDivisions;
 Countz = 
  BinCounts[
   Flatten@Map[ArcTan @@ (# - ScreenCenter) &, list, {1}], {-Pi, Pi, dAng}];

 SectorChart[{ConstantArray[1, Length[Countz]], Countz}\[Transpose], 
  SectorOrigin -> {-\[Pi]/angleDivisions, "Counterclockwise"}, 
  PolarAxes -> True, PolarGridLines -> {Automatic, {1, 2, 3, 4, 5}},
  PolarAxesOrigin -> {Pi/2, 5}, 
  PolarTicks -> {Table[{i \[Degree] + \[Pi]/angleDivisions, 
      i \[Degree]}, {i, 0, 345, 30}], Range[5]}, 
  ChartStyle -> {Directive[EdgeForm[{Black, Thickness[0.005]}], Red]},
   BaseStyle -> {FontFamily -> "Arial", FontWeight -> Bold, FontSize -> 12}, 
  ImageSize -> 400, 
  ChartElementFunction -> 
   Function[{range}, 
    Disk[{0, 0}, range[[2, 2]], -11 Pi/12 + range[[1]]]],
  Epilog -> {Red, Thick, Line[{{0, 0}, 5/Sqrt[2] {1, 1}}]},
  Prolog -> {Gray, Disk[{0, 0}, 5]}]]

sectorchart with line and gray background

Heike
  • 24,102
  • 2
  • 31
  • 45
  • Heike, How can I adapt the angle of the line, for let`s 37.5 Degree ? I don`t understand in which coordinate system this line is.Many Thanks. – 500 Sep 18 '11 at 21:26
  • @500 In the Epilog: `Line[{0,0}, r {Cos@Phi,Sin@Phi}]` where `r` is the radius and `Phi` is your angle – Dr. belisarius Sep 18 '11 at 23:33
  • @belisarius, thank you. I think it needs {} to make it works. Also I am still confuse, the angle are in degrees to me yet. in which format shall phi be ? – 500 Sep 19 '11 at 00:09