質問

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.

enter image description here

役に立ちましたか?

解決

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]]

enter image description here

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 :)

EDIT:

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:

enter image description here

他のヒント

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.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top