gpt4 book ai didi

wolfram-mathematica - 数学 : is it possible to put AxesLabel for 3D graphics at the end of the axes as in 2D?

转载 作者:行者123 更新时间:2023-12-04 08:12:08 25 4
gpt4 key购买 nike

根据

http://reference.wolfram.com/mathematica/ref/AxesLabel.html

它说

“默认情况下,二维图形中的轴标签放置在轴的末端。在三维图形中,它们与轴的中间对齐。”

我想将轴标签放在轴的末端,也用于我的 3D 绘图,因为这让我很容易看到当我在 3D 对象上进行旋转等时哪些轴现在在哪里。

我找不到一个技巧来做到这一点。这是一个例子

g=Graphics3D[
{
Cuboid[{-.1,-.1,-.1},{.1,.1,.1}],
{Red,PointSize[.03],Point[{3,0,0}]},
{Black,PointSize[.03],Point[{0,3,0}]},
{Blue,PointSize[.03],Point[{0,0,3}]}
},
AxesOrigin->{0,0,0},
PlotRange->{{-3,3},{-3,3},{-3,3}},
Axes->True,
AxesLabel->{"X","Y","Z"},
LabelStyle->Directive[Bold,Red,16],
PreserveImageOptions->False,
Ticks->None,
Boxed->False
]

此外,它说 3D 的轴标签应该在轴的“中间”。

但是查看生成的 Graphics3D,在我看来标签根本不在中间。可能是缩放问题,现在不确定,但看起来标签离原点太近了。

谢谢,

最佳答案

您可以在您选择的位置手动绘制标签:

Graphics3D[
{ Cuboid[{-.1,-.1,-.1},{.1,.1,.1}]
, Text[Style["X", Bold, Red, 16], {3, 0, 0}]
, Text[Style["Y", Bold, Black, 16], {0, 3, 0}]
, Text[Style["Z", Bold, Blue, 16], {0, 0, 3}]
}
, AxesOrigin -> {0, 0, 0}
, PlotRange -> {{-3, 3}, {-3, 3}, {-3, 3}}
, Axes -> True
, PreserveImageOptions -> False
, Ticks -> None
, Boxed -> False
]
axis labels

关于wolfram-mathematica - 数学 : is it possible to put AxesLabel for 3D graphics at the end of the axes as in 2D?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6182676/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com