2011-09-18 39 views
0

From Cartesian Plot to Polar Histogram using Mathematica建立起來,我想自定義將R和θ軸:PolarTicks,極地網格線和背景定製

請考慮:

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[ [email protected][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 /我想添加一個以45度着色的「theta bar」(如圖所示)。不過,我使用ppt。我無法找到一個方法來讓表格獲得主要的theta軸,並繪製另一個不同的顏色。

enter image description here

3/I未能適應設置在Customsize Backgroud in Plot within Mathematica到Polarplot使用Prolog的溶液中。是否有可能讓灰色地帶的外圍圓圈內的區域讓我們說出來?

回答

3

您可以使用Epilog爲背景創建線條,並且使用Prolog

Module[{Countz, maxScale, angleDivisions, dAng}, maxScale = 4; 
angleDivisions = 12; 
dAng = (2 \[Pi])/angleDivisions; 
Countz = 
    BinCounts[ 
    [email protected][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

+0

謝謝海克! – 500

+0

Heike,我如何調整線的角度,讓我們37.5度?我不明白這條線在哪個座標系下。很多謝謝。 – 500

+0

@ 500在結語:'線[{0,0},R {@的Cos皮皮,仙@披}]''那裏是r'半徑和'Phi'是你的角度 –