Please consider :
colors = {Red, Green, Blue};
style = {Thickness[.01], Thickness[.01], Thickness[.01]};
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},
Blue, Specularity[White, 3], Sphere[{.5, .5, .5}, .1]},
Boxed -> False, FaceGrids -> All,
FaceGridsStyle -> Directive[Black, Dashed]]
Using Yoda`s solution on How to Style Lines
How could I color the Sphere using GrayLevel (I will manipulate it later).
And How could I have denser FaceGrids ? 10 Lines horizontally & Vertically. I also don`t understand why the Edges one are distant to one another.
It's always good practice to group the graphics object and its styles in a list, in case you need to quickly add another one with different styles. By that, I mean write it as {Blue, Specularity[White, 3], Sphere[{.5, .5, .5}, .1]}
. Now you can easily add a GrayLevel
term before Sphere
and it'll work.
For the FaceGrids
, I believe you'll have to manually define the lines at your desired spacing for each face. Here's an example for showing how to do it for one face.
Graphics3D[{{#1, #2, Line@#3} & @@@
Transpose@{colors, style, cAxes}, {Blue, GrayLevel[0.3], Lighting -> "Neutral",
Specularity[White, 3], Sphere[{.5, .5, .5}, .1]}}, Boxed -> False,
FaceGrids -> {{{0, 0, 1},
Transpose@({#, #} & /@ Range[0, 1, 0.1])}},
FaceGridsStyle -> Directive[Black, Dashed]]
The faces are defined as ±1
for the corresponding plane and the other two are zero. So {0,0,1}
in my example corresponds to the z=1
plane.
The list supplied to FaceGrids
can be easily computed for each face, instead of manually entering them, but I'll leave that to you :)
Since you want a uniform mesh all around, define where you want the grid lines drawn as
gridList = Transpose@({#, #} & /@ Range[0, 1, 0.1]);
Then, use the following for FaceGrids
:
FaceGrids -> Join @@ Table[{RotateLeft[j {0, 0, 1}, i], gridList},
{i, {0, 1, 2}}, {j, {-1, 1}}]
Here's how the result should look like with PlotRangePadding -> None
:
In addition to Yoda's response:
Lighting -> "Neutral"
will allow grayscale object to show up as gray instead of with various colors.
PlotRangePadding -> None
will remove the spaces on the grid lines (depending on the setting for PlotRange
.)
Yoda beat me to typing out the FaceGrids
setting (see documentation ). But here is an alternative.
Instead of setting the FaceGrids
setting explicitly, youcould also try setting FrameTicks
, since by default the FaceGrids
follow these, and then style the FrameTicks
to be invisible using Opacity
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.