Mathematica 二维图中的多条线段图

发布于 2024-10-11 01:05:30 字数 140 浏览 2 评论 0原文

我想在 Mathematica 的单个二维图中绘制多个,也许数千个线段。这些线段将通过检测并保存每个线段端点的算法来确定。一旦算法确定了有限二维绘图域和范围(例如,x = 0,4 和 y=0,0.5)内的所有线段,我想将它们全部绘制在单个绘图上。 感谢您的任何建议。

I would like to plot multiple, perhaps thousands of line segments on a single 2D plot in Mathematica. These line segments would be determined from an algorithm that would detected and save each segments endpoints. Once the algorithm has determined all the line segments within a finite 2D plot domain and range (e.g., x = 0,4 and y=0,0.5), I would like to plot them all on a single plot.
Thanks for any suggestions.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

鸩远一方 2024-10-18 01:05:30

像这样的东西吗?

detectEndPoints := {
   {RandomReal[{0, 4}], RandomReal[{0, 5}]},
   {RandomReal[{0, 4}], RandomReal[{0, 5}]}};

segments = Table[detectEndPoints , {1000}]; 

(* Graphics[Line /@ segments]   Old Way *)
Graphics[Line @ segments]  (* Valid since V6. Thanks @Mark McClure *)

alt text

哈!

编辑

重新阅读您的问题,我不确定您是通过一次确定一个端点还是一组非连接线段(如上所述)来生成一条连续线。以防万一您要继续使用:

detectEndPointsV2[i_] := {Cos[2 Pi i 17/100], Sin[2 Pi 17 i/100]}; 
segments = Table[detectEndPointsV2[i], {i, 101}]; 
Graphics[Line@segments]

alt text

Something like this?

detectEndPoints := {
   {RandomReal[{0, 4}], RandomReal[{0, 5}]},
   {RandomReal[{0, 4}], RandomReal[{0, 5}]}};

segments = Table[detectEndPoints , {1000}]; 

(* Graphics[Line /@ segments]   Old Way *)
Graphics[Line @ segments]  (* Valid since V6. Thanks @Mark McClure *)

alt text

HTH!

Edit

Re-reading your question, I am not sure whether you are generating a continuous line by determining one endpoint at a time, or a set of non-connected segments (as above). Just in case you are going the continuous way:

detectEndPointsV2[i_] := {Cos[2 Pi i 17/100], Sin[2 Pi 17 i/100]}; 
segments = Table[detectEndPointsV2[i], {i, 101}]; 
Graphics[Line@segments]

alt text

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文