Truncating a surface plot in Matlab

In summary, the speaker is seeking a way to truncate the top of their surface plot in a way that does not change the shape of the surface between points. They are open to either cutting off the top or flattening it, and are hoping for a simple solution using the "hold on" and "hold off" commands in conjunction with the "zlim" command.
  • #1
ballzac
104
0
Hi,
My thesis involves several surface plots. Most of the interesting features of these plots (and also the region I am interested in) are between z=0 and z=0.2, but there are a few points that have values as high as z=4. I want to view only the region of interest, so I use

Code:
zlim([0 0.2])

This works fine in the sense that it zooms in on the region of interest, but it does not truncate parts of the plot above z=0.2. This means that the surface extends above the axes, all the way up to the top of the figure when viewed from an oblique angle. Cosmetically, I feel this is unacceptable for a thesis, and I would like the plot to be truncated at the axis limits without affecting the location of the points.

I am okay with it either 'cutting' the top off, or flattening it at the top, but would probably prefer the former. Unfortunately, changing the actual values in this region (by setting any point with a value greater that z=0.2 to 0.2) changes the actual shape of the surface between these points and the neighbouring points.

There must be simple solution for this, but I can't find one. Hopefully someone has some ideas. Thanks in advance.
 
Physics news on Phys.org
  • #2


Hi there,

Thank you for sharing your issue with us. I understand your concerns about the visual presentation of your surface plots in your thesis. One possible solution to achieve the desired truncation without altering the shape of the surface between points would be to use the "hold on" and "hold off" commands in conjunction with the "zlim" command.

First, use the "hold on" command to hold the current plot and then use the "zlim" command to set the desired limits for the z-axis. Next, use the "hold off" command to release the hold and plot the surface again, which should now be truncated at the desired z-axis limit without affecting the shape of the surface between points. This can be repeated for each surface plot in your thesis.

I hope this helps and best of luck with your thesis. Let me know if you have any further questions or need any additional assistance.
 

1. What does it mean to truncate a surface plot?

Truncating a surface plot in Matlab refers to the process of limiting the displayed range of values on the z-axis of the plot. This can be useful for focusing on a specific range of data or for enhancing the visual appearance of the plot.

2. How do I truncate a surface plot in Matlab?

To truncate a surface plot in Matlab, you can use the "caxis" function and specify the desired range of values to be displayed on the z-axis. For example, "caxis([0 10])" will limit the plot to display values between 0 and 10 on the z-axis.

3. Can I truncate a surface plot without changing the underlying data?

Yes, truncating a surface plot in Matlab does not affect the underlying data. It simply changes the display range of the z-axis on the plot.

4. What is the default range of values displayed on a surface plot in Matlab?

The default range of values displayed on a surface plot in Matlab is the full range of the data. This means that the minimum and maximum values on the z-axis will correspond to the minimum and maximum values in the data set.

5. Can I customize the color scale when truncating a surface plot in Matlab?

Yes, you can customize the color scale when truncating a surface plot in Matlab by using the "colormap" function. This allows you to choose the colors and their corresponding values for the truncated range of data on the z-axis.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
10
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
740
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • Programming and Computer Science
Replies
2
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
3K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
5K
Back
Top