Solve Mathematica Plotting Problems: Z-Axis Limits

  • Mathematica
  • Thread starter natski
  • Start date
  • Tags
    Mathematica
In summary, I was able to solve my problem by using the PlotRange option and by adjusting the x and y bounds.
  • #1
natski
267
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
  • #2
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:
  • #3
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
 
  • #4
Seems LENIN is quicker than I.

Well, it seems LENIN and I agree atleast. So it should work.
 
  • #5
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.
 

Related to Solve Mathematica Plotting Problems: Z-Axis Limits

1. How do I change the limits of the z-axis in a Mathematica plot?

To change the limits of the z-axis in a Mathematica plot, use the PlotRange option. For example, PlotRange -> {zmin, zmax} will set the minimum and maximum values for the z-axis. You can also use PlotRange -> All to automatically adjust the limits based on the data in the plot.

2. Why is my z-axis limit not changing when I use the PlotRange option?

If your z-axis limit is not changing when you use the PlotRange option, make sure that you are specifying the option for the correct plot. You may also need to use the PlotRangePadding option to ensure that the entire plot is visible.

3. How can I set the z-axis limits to be equal to the x and y-axis limits?

To set the z-axis limits to be equal to the x and y-axis limits, use the PlotRange -> All option. This will automatically adjust the z-axis limits to match the x and y-axis limits.

4. Can I set different z-axis limits for different plots in the same Mathematica notebook?

Yes, you can set different z-axis limits for different plots in the same Mathematica notebook. Simply use the PlotRange option for each plot, specifying the desired limits.

5. Is there a way to adjust the z-axis limits based on the data in the plot?

Yes, you can use the PlotRange -> All option to automatically adjust the z-axis limits based on the data in the plot. This will ensure that all data is visible in the plot without cutting off any points.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
535
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
3K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
4K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
3
Views
6K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
4K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • Introductory Physics Homework Help
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
11
Views
16K
Back
Top