# Contour plot cutting off surface value?

2 views (last 30 days)
aaron Harvey on 23 Mar 2016
Commented: aaron Harvey on 23 Mar 2016
Hi i have a contour plot showing a depth profile of nutrients in the ocean over time however when using meshgrid to interpolate it doesn't seem to be calculating any values for the upper most layer?
[xq,yq] = meshgrid(min(date):1/12:max(date),-4000:100:0);
varq = griddata(date,-depth,var,xq,yq);
[hc hc]=contourf(xq,yq,varq,N-1);
using the above code it plots a contour map from -4000m up to -100m but only white space from -100m to 0m? The only way i have been able to change this is by changing the steps in the meshgrid from -4000:100:0 to -4000:0 however this creates a very grainy contourplot and ideally i would like to keep the averaged smoother plot? how can i do this without loosing the surface data?
##### 1 CommentShowHide None
aaron Harvey on 23 Mar 2016
Thank-you for your reply however i'm definitely not reaching the resolution of my data. here's a simple scatter(date,depth,z)
and here's my rubbish contour plot that cutting of the top 100m?

Sign in to comment.

### Answers (1)

Mike Garrity on 23 Mar 2016
We don't have access to your data, so we can only guess, but ...
When you say that increasing the grid resolution makes the contour "grainier", then my guess would be that you're not interpolating at all. My guess would be that you are actually approaching the resolution of your input data, and that the coarser grid is simply subsampling.
I would suggest comparing your gridded data with your original data by combining a surface and a scatter, as I showed in the thread for this question. You can do that for a subset of your data if it's large. If the high-res grid is comparable to the spacing of your original data points, then I think you need to be careful about how you go down to the low-res grid. You would really want to low-pass filter to make sure you're not aliasing any high frequencies in your data.
##### 0 CommentsShowHide -1 older comments

Sign in to comment.

### Categories

Find more on Surface and Mesh Plots in Help Center and File Exchange

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by