簡體   English   中英

在Mathematica中使用Graphics3D的線條樣式

[英]Line Style using Graphics3D in Mathematica

考慮以下 :

cAxes = {{{0, 0, 0}, {0, 0, 1}}, {{0, 0, 0}, {0, 1, 0}}, {{0, 0,0}, {1, 0, 0}}};

Graphics3D[{Line /@ cAxes}, Boxed -> False]

在此輸入圖像描述

Style如何以不同的方式改變3條線?

上面的答案很好,但我想展示一些替代方案。

我表明可以使用Style ,而TubeLine一個有趣替代品。

cAxes = {{{0, 0, 0}, {0, 0, 1}}, {{0, 0, 0}, {0, 1, 0}}, {{0, 0, 
     0}, {1, 0, 0}}};

tubes = Tube@# ~Style~ #2 & ~MapThread~ {cAxes, {Red, Green, Blue}};

Graphics3D[tubes, Boxed -> False]

在此輸入圖像描述

這是一個例子:

colors = {Red, Green, Blue};
style = {Dashed, DotDashed, Dotted};
cAxes = {{{0, 0, 0}, {0, 0, 1}}, {{0, 0, 0}, {0, 1, 0}}, {{0, 0, 
     0}, {1, 0, 0}}};
Graphics3D[{#1, #2, Line@#3} & @@@ Transpose@{colors, style, cAxes}, 
 Boxed -> False]

在此輸入圖像描述

另外請記住,如果需要,可以使用Plot3D:

colors = {Red, Green, Blue};
style = {Dashed, DotDashed, Dotted};
Plot3D[{}, {x, 0, 10}, {y, 0, 10}, 
 AxesLabel -> {x, y, z}, 
 AxesStyle -> Directive /@ Transpose@{colors, style}, 
 Boxed     -> False]

你也可以使用MapThread

cAxes = {{{0, 0, 0}, {0, 0, 1}}, {{0, 0, 0}, {0, 1, 0}}, {{0, 0, 0}, {1, 0, 0}}};

Graphics3D[{
   MapThread[{#1, Line[#2]} &, {{Red, Blue, Green}, cAxes}]
   }, Boxed -> False]

未經測試(我現在無法訪問Mathematica):

Graphics3D[Transpose@{{Red, Green, Blue}, Line /@ cAxes}, Boxed -> False]

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM