Mathematica Solve Mathematica Plotting Problems: Z-Axis Limits

  • Thread starter Thread starter natski
  • Start date Start date
  • Tags Tags
    Mathematica
AI Thread Summary
To set the z-axis limits in Mathematica for 3D plots, use the PlotRange option in the Plot3D command. The syntax is Plot3D[f(x,y), {x, min_x, max_x}, {y, min_y, max_y}, PlotRange -> {min_z, max_z}]. The default setting for PlotRange is Automatic, which may not always display the desired range. Adjusting the x and y ranges to smaller values can also help in achieving better results. For 2D plots, the same PlotRange option applies, formatted as PlotRange -> {min, max}. If further assistance is needed, joining the Mathematica listserve can provide additional support. The discussion confirms that using these options successfully resolved the original issue with the z-axis limits.
natski
Messages
262
Reaction score
2
I have searched the Mathematica bible long and hard and done various searches in the help index of Mathematica but have found nowhere instructions on how to solve my problem.

For a 2D, or in my case 3D plot, you choose the x and y axes easily by setting them in the initial command to plot your function, but there does not seem to be anyway to choose the z axis limits? I am reasonably confident Mathematica is chopping off most of my function and I want to extend the z axis up to higher limits to observe the full plot. Has anyone else experienced this problem?
 
Physics news on Phys.org
What you are probebly looking for is the PlotRange option. You should use it like this:

Code:
Plot3D[f(x,y),{x,min_x,max_x},{y,min_y,max_y},PlotRange->{min_z,max_z}]

Also becouse the default setting of PlotRange is Automatic and it usualy work preaty well, it might be a good idea to reconsieder your x and y renges (make them smaller if you don't REALLY need them that big).

Hope this helped.

PS: This thread might be more sutible for the Computers/Programming forum.
 
Last edited:
Well, I could be wrong, but in the case of the 2D case all you do is use the tag PlotRange->{min,max} as an option. So for 3D I would use the same option and change the PlotRange.

It would look something like:
Plot3D[function, {x,xmin,xmax}, {y,ymin,ymax}, PlotRange->{zmin,zmax}]

Give it a try. There is also a listserve for Mathematica. Send a message asking to be added to it at: mathgroup@smc.vnet.net

Let me know if that works or not.
Cheers,
Norm
 
Seems LENIN is quicker than I.

Well, it seems LENIN and I agree atleast. So it should work.
 
Thank-you, this was very helpful and correcetd my problem. I can't fathom why Mathematica insisted on plotting just bizarre z-axes by default but I have now a nice plot of the correct function.
 

Similar threads

Replies
3
Views
4K
Replies
4
Views
4K
Replies
3
Views
6K
Replies
2
Views
1K
Replies
2
Views
4K
Back
Top