3

考虑以下 :

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

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

在此处输入图像描述

如何对 3 行进行不同的样式设置?

4

5 回答 5

6

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

我展示了它可以Style用于这个,这Tube是一个有趣的替代Line.

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]

在此处输入图像描述

于 2011-11-14T00:16:09.943 回答
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]

在此处输入图像描述

于 2011-11-13T23:43:43.060 回答
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]
于 2011-11-13T23:59:28.237 回答
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]
于 2011-11-14T00:01:53.030 回答
3

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

Graphics3D[Transpose@{{Red, Green, Blue}, Line /@ cAxes}, Boxed -> False]
于 2011-11-13T23:37:18.157 回答