gpt4 book ai didi

graphics - 使用 Mathematica 中的图形在对象内均匀分布点

转载 作者:行者123 更新时间:2023-12-04 06:21:26 25 4
gpt4 key购买 nike

考虑:

preferred ={{1, 1, 63}, {2, 1, 44}, {3, 1, 27}, {4, 1, 33}, {5, 1, 33}}

frmWidth = 20.9067;
frmHeight = 15.68;

我展示了 5 种类型的刺激 2 by 2。受试者必须选择他们喜欢的一种。每种类型的刺激都会显示 80 次,因此:

{1,1,63} 表示刺激 Cond 1 在显示的 80 次中被首选 63 次。
{3, 1, 27} 表示刺激 Cond 3 在显示的 80 次中有 27 次被首选。

Cond1 指屏幕中心

Cond2 指左上象限

Cond3 是指右上象限

Cond4 是指左下象限

Cond5 是指右下象限

我想表达这个显示结果。

这就是我所做的:
Graphics[{
Black, EdgeForm[{Thin, LightGray}],
Rectangle[{-1, -1}, {frmWidth + 1, frmHeight + 1}],

PointSize[0.03],
Yellow,
Point@Tuples[{Range[0, frmWidth/2, frmWidth/19],
Range[0, frmHeight/2, frmHeight/14]}][[;; preferred[[5, 3]]]],

Red,
Point@Tuples[{Range[frmWidth/2, frmWidth, frmWidth/19],
Range[0, frmHeight/2, frmHeight/14]}][[;; preferred[[4, 3]]]],

Green,
Point@Tuples[{Range[frmWidth/2, frmWidth, frmWidth/19],
Range[frmHeight/2, frmHeight, frmHeight/14]}][[;; preferred[[3, 3]]]],

Orange,
Point@Tuples[{Range[0, frmWidth/2, frmWidth/19],
Range[frmHeight/2, frmHeight, frmHeight/14]}][[;;
preferred[[2, 3]]]],

Blue,
Point@Tuples[{Range[frmWidth/4, 3/4 frmWidth, frmWidth/19],
Range[frmHeight/4, 3/4 frmHeight, frmHeight/14]}][[;;
preferred[[1, 3]]]]

}]

enter image description here

问题是矩形从左到右逐渐填充点,而不是点被统一定位。

考虑以下 :
Graphics[{

White, EdgeForm[Thick],
Rectangle[{0, 0}, {frmWidth, frmHeight}],

Orange, Opacity[.5],
Rectangle[{0, frmHeight/2}, {frmWidth/2, frmHeight}, RoundingRadius -> 3],

Green,
Rectangle[{frmWidth/2, frmHeight/2}, {frmWidth, frmHeight},RoundingRadius -> 3],

Red,
Rectangle[{frmWidth/2, 0}, {frmWidth, frmHeight/2}, RoundingRadius -> 3],

Yellow,
Rectangle[{0, 0}, {frmWidth/2, frmHeight/2}, RoundingRadius -> 3],

Blue,
Rectangle[{frmWidth/4, frmHeight/4}, {3/4 frmWidth, 3/4 frmHeight}, RoundingRadius -> 3]
}]

enter image description here

现在我想用点填充那些边缘圆角矩形,但密度会发生变化,而不是填充的矩形部分。

下面是我在PPT中画的很丑的东西:

enter image description here

理想情况下,用点填充的形状可以是任何类型。
点不会重叠。


请让我知道其他想法。

最佳答案

好的,试试这个:

Manipulate[ld = Floor[Sqrt[n]];
Graphics[
{{EdgeForm[Dashed], White,
Polygon[{{0, 0}, {0, h}, {w, h}, {w, 0}}]},
Point[Flatten[#, 1] &@
Table[{x, y}, {x, 0, w, w/ld}, {y, 0, h, h/ld}]] },
PlotRange \[Rule] {{-1, 20}, {-1, 20}}],
{{n, 25}, 10, 100, 1},
{{h, 10}, 5, 20},
{{w, 10}, 5, 20}]

典型配置:

enter image description here

(我提供的代码让您可以通过 slider 控制框的总数和大小)

关于graphics - 使用 Mathematica 中的图形在对象内均匀分布点,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6509471/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com