0
$\begingroup$
RegionPlot3D[
x^2 + y^2 + z^2 <= 1, {x, -1, 0.75}, {y, -1, 0.75}, {z, -1, 1}, 
ImageSize -> 400, Boxed -> True, Axes -> True, 
AxesOrigin -> {1, 1, -1}, 
Lighting -> {{"Directional", Gray, ImageScaled[{2, 0, 2}]}}, 
ViewPoint -> {-1, 1, -2.7}, ViewAngle -> 35 Degree, 
ViewVertical -> {0, 0, 1}]  

I would like this object face to me with position and angle as below:
enter image description here
But after I compute notebook again, the object position and angle changed to :
enter image description here
I cannot control the output,even changed to:
enter image description here

How to solve this porblem?

$\endgroup$
  • 1
    $\begingroup$ Hard to expect anything else if you keep fixed ViewVertical -> {0, 0, 1}, ViewPoint -> {-1, 1, -2.7}. Drop it and if you keep rotated output then the new one will inherit view settings. $\endgroup$ – Kuba Mar 15 '18 at 7:20
  • $\begingroup$ Was that the problem? $\endgroup$ – Kuba Mar 15 '18 at 8:05
  • $\begingroup$ I am new to mathematica,need more time to digest your comments,headache! $\endgroup$ – kittygirl Mar 15 '18 at 8:46
  • $\begingroup$ Delete ViewPoint -> Evaluate plot -> rotate -> evaluate again. $\endgroup$ – Kuba Mar 15 '18 at 8:47
  • $\begingroup$ ViewPoint gives the position of the view point relative to the center of the three-dimensional box that contains the objects.This option help to fix the view,why should I delete it?I set wrong ViewPoint? $\endgroup$ – kittygirl Mar 15 '18 at 8:51
1
$\begingroup$

There are many combinations of view point and view angle that will give the figure you want. A fast and easy way to arrive a suitable combination is to use a Manipulate expression to shift view point and view angle.

Manipulate[
  RegionPlot3D[
    x^2 + y^2 + z^2 <= 1, {x, -1, 0.75}, {y, -1, 0.75}, {z, -1, 1},
    ImageSize -> 400,
    Lighting -> {{"Directional", Gray, ImageScaled[{2, 0, 2}]}},
    ViewAngle -> angle Degree,
    ViewPoint -> {xV, yV, zV}],
  {{xV, 1}, 0, 5, .1, AppearanceElements -> All}, 
  {{yV, 2}, 0, 5, .1, AppearanceElements -> All},
  {{zV, -2}, -5, 0, .1, AppearanceElements -> All},
  {{angle, 30}, 10, 40, 2, AppearanceElements -> All}]

It comes up looking this.

initial

A few seconds of adjusting the sliders finds an acceptable combination.

adjusted

That such a combination happens at xV == yV == -zV is a simple exercise in visualization that you should try for yourself.

Now you can write a plot expression that will show your image in the position that you want it to have. I use Deploy to prevent the viewer from changing the presented view.

Deploy @ 
  RegionPlot3D[
    x^2 + y^2 + z^2 <= 1, {x, -1, 0.75}, {y, -1, 0.75}, {z, -1, 1},
    ImageSize -> 400,
    Lighting -> {{"Directional", Gray, ImageScaled[{2, 0, 2}]}},
    ViewAngle -> 20 Degree,
    ViewPoint -> {3, 3, -3}]

final

$\endgroup$
  • $\begingroup$ When I add option PlotPoints->100,Manipulate has no output. $\endgroup$ – kittygirl Mar 16 '18 at 1:10
  • $\begingroup$ @kittygirl. I don't see why you need to add that option. Also, without seeing exactly how you changed my code, I can't really tell what you did wrong. Perhaps, Manipulate can't plot fast enough when ask for so many points. $\endgroup$ – m_goldberg Mar 16 '18 at 1:18
  • $\begingroup$ @kittygirl. Thanks for accepting my answer. But I don't understand why you considered it worth an acceptance but not an up-vote. You are aware, aren't you, that you can do both? $\endgroup$ – m_goldberg Mar 16 '18 at 1:39
  • $\begingroup$ ,Thanks for your good answer!Abosultely worth an up-vote! $\endgroup$ – kittygirl Mar 16 '18 at 3:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.