在Mathematica中使用Graphics3D的线条样式

时间:2011-11-13 23:28:42

标签: graphics 3d wolfram-mathematica mathematica-8

请考虑以下事项:

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

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

enter image description here

如何使用3种不同的样式?

5 个答案:

答案 0 :(得分:6)

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

我表示可以使用Style来表示TubeLinecAxes = {{{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] 的有趣替代品。

{{1}}

enter image description here

答案 1 :(得分:4)

以下是一个例子:

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]

enter image description here

答案 2 :(得分:4)

另外请记住,如果需要,你也可以使用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]

答案 3 :(得分:4)

您也可以使用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]

答案 4 :(得分:3)

未经测试(我现在无法访问Mathematica):

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