请考虑以下事项:
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种不同的样式?
答案 0 :(得分: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]
的有趣替代品。
{{1}}
答案 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]
答案 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]