Wolfram mathematica Arctan Binning,从绘图到直方图,技巧 基于Sjoerd,很好的解和延拓,请考虑以下内容: list = {{21, 16}, {16, 14}, {11, 11}, {11, 12}, {13, 15}, {18, 17}, {19, 11}, {17, 16}, {16, 19}} ScreenCenter = {20, 15} ListPolarPlot[{ArcTan[##], EuclideanDistance[##]} & @@@ (# - ScreenCenter & /@ list), PolarAxes -> True, PolarGridLines -> Automatic, Joined -> False, PolarTicks -> {"Degrees", Automatic}, BaseStyle -> {FontFamily -> "Arial", FontWeight -> Bold, FontSize -> 12}, PlotStyle -> {Red, PointSize -> 0.02}]
如您所见,直方图显示了它应该显示的旋转对称性。 我想尽一切办法把这些事情弄清楚,但没有成功。没有倒车,情况最糟。我试过旋转,但没有成功。我觉得问题出在我的箱子里。 ArcTan输出从-Pi到Pi,而Sjoerd建议我需要从0到2Pi。但是我不知道怎么做。 编辑:问题解决了。多亏了Sjoerd、Belisarius和Heike solutions,我能够在给定图像重心的情况下显示眼睛注视位置的直方图Wolfram mathematica Arctan Binning,从绘图到直方图,技巧 基于Sjoerd,很好的解和延拓,请考虑以下内容: list = {{21, 16}, {16, 14}, {11, 11}, {11, 12}, {13, 15}, {18, 17}, {19, 11}, {17, 16}, {16, 19}} ScreenCenter = {20, 15} ListPolarPlot[{ArcTan[##], EuclideanDistance[##]} & @@@ (# - ScreenCenter & /@ list), PolarAxes -> True, PolarGridLines -> Automatic, Joined -> False, PolarTicks -> {"Degrees", Automatic}, BaseStyle -> {FontFamily -> "Arial", FontWeight -> Bold, FontSize -> 12}, PlotStyle -> {Red, PointSize -> 0.02}],wolfram-mathematica,bin,Wolfram Mathematica,Bin,如您所见,直方图显示了它应该显示的旋转对称性。 我想尽一切办法把这些事情弄清楚,但没有成功。没有倒车,情况最糟。我试过旋转,但没有成功。我觉得问题出在我的箱子里。 ArcTan输出从-Pi到Pi,而Sjoerd建议我需要从0到2Pi。但是我不知道怎么做。 编辑:问题解决了。多亏了Sjoerd、Belisarius和Heike solutions,我能够在给定图像重心的情况下显示眼睛注视位置的直方图 正在检查,但您的第一个情节似乎有缺陷: list = {{21, 16}, {16, 14}, {
正在检查,但您的第一个情节似乎有缺陷:
list = {{21, 16}, {16, 14}, {11, 11}, {11, 12}, {13, 15},
{18, 17}, {19, 11}, {17, 16}, {16, 19}};
ScreenCenter = {20, 15};
Show[ListPlot[list, PlotStyle -> Directive[PointSize[Medium], Purple]],
Graphics[
{Red, PointSize[Large], Point[ScreenCenter],
Circle[ScreenCenter, 10]}],
AspectRatio -> 1, Axes -> False]
编辑
我没有完全遵循您的代码,但屏幕中心的反射似乎解决了问题:
Module[{Countz, maxScale, angleDivisions, dAng},
Countz = BinCounts[
{ArcTan[Sequence @@ ##]} & /@ (# + ScreenCenter & /@ -list),
{-Pi, Pi, Pi/6}];
maxScale = 4;
angleDivisions = 12;
dAng = (2 Pi)/angleDivisions;
SectorChart[{ConstantArray[1, Length[Countz]], Countz}\[Transpose],
SectorOrigin -> {-Pi/angleDivisions, "Counterclockwise"},
PolarAxes -> True,
PolarGridLines -> Automatic,
PolarTicks -> {Table[{i \[Degree] + Pi/angleDivisions,
i \[Degree]}, {i, 0, 345, 30}], Automatic},
ChartStyle -> {Directive[EdgeForm[{Black, Thickness[0.005]}], Red]},
BaseStyle -> {FontFamily -> "Arial", FontWeight -> Bold,
FontSize -> 12},
ImageSize -> 400]]
编辑
在这里,您可能会看到我的代码中的小偏差,这在Heike的回答中得到了解决(投赞成票!)
您可以使用
ChartElementFunction
选项精确定位扇区。ChartElementFunction
的第一个参数的形式为{{angleMin,angleMax},{rMin,rMax}
。第一个扇区有边界{angleMin,angleMax}={-Pi/12,Pi/12}
,第二个扇区有边界{Pi/12,3pi/12}
,等等。因此,要获得正确的旋转,可以执行以下操作
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,
PolarTicks -> {Table[{i \[Degree] + \[Pi]/angleDivisions,
i \[Degree]}, {i, 0, 345, 30}], Automatic},
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]]]]]]
@beliarius:当以
ArcTan[x,y]
的形式使用ArcTan
时,范围是(-Pi,Pi]
@belisarius,对不起,我现在实在是太离谱了:-(.谢谢你的帮助!@500请注意Heike的解决方案,因为它似乎与betterI的位置相匹配。我在你最初提问的地方给出了这个问题的答案。@Sjoerd也许我错了,但在我看来,你的极坐标直方图并不能代表点密度。也许缺少对称变换。(见你回答中的90-135度范围)我觉得自己很好的那一刻,我回来看到你的解决方案和belisarius的评论,谢谢你,我甚至没有注意到酒吧的位置,这太整洁了。
Module[{Countz, maxScale, angleDivisions, dAng},
Countz = BinCounts[
{ArcTan[Sequence @@ ##]} & /@ (# + ScreenCenter & /@ -list),
{-Pi, Pi, Pi/6}];
maxScale = 4;
angleDivisions = 12;
dAng = (2 Pi)/angleDivisions;
SectorChart[{ConstantArray[1, Length[Countz]], Countz}\[Transpose],
SectorOrigin -> {-Pi/angleDivisions, "Counterclockwise"},
PolarAxes -> True,
PolarGridLines -> Automatic,
PolarTicks -> {Table[{i \[Degree] + Pi/angleDivisions,
i \[Degree]}, {i, 0, 345, 30}], Automatic},
ChartStyle -> {Directive[EdgeForm[{Black, Thickness[0.005]}], Red]},
BaseStyle -> {FontFamily -> "Arial", FontWeight -> Bold,
FontSize -> 12},
ImageSize -> 400]]
Show[Module[{Countz, maxScale, angleDivisions, dAng},
Countz = BinCounts[{ArcTan[
Sequence @@ ##]} & /@ (# +
ScreenCenter & /@ -list), {-\[Pi], \[Pi], \[Pi]/6}];
maxScale = 4;
angleDivisions = 12;
dAng = (2 \[Pi])/angleDivisions;
SectorChart[{ConstantArray[1, Length[Countz]], Countz}\[Transpose],
SectorOrigin -> {-\[Pi]/angleDivisions, "Counterclockwise"},
PolarAxes -> True, PolarGridLines -> Automatic,
PolarTicks -> {Table[{i \[Degree] + \[Pi]/angleDivisions,
i \[Degree]}, {i, 0, 345, 30}], Automatic},
ChartStyle -> {Directive[EdgeForm[{Black, Thickness[0.005]}],
Red]}, BaseStyle -> {FontFamily -> "Arial", FontWeight -> Bold,
FontSize -> 12}, ImageSize -> 400]],
ListPlot[Plus[# - ScreenCenter] & /@ list/2.5,
PlotMarkers -> Image[CrossMatrix[10], ImageSize -> 10]]
]
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,
PolarTicks -> {Table[{i \[Degree] + \[Pi]/angleDivisions,
i \[Degree]}, {i, 0, 345, 30}], Automatic},
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]]]]]]