Asked by Parham Ebrahimi
on 21 Aug 2019

Hello everyone!

Could you please help me with this:

I have a 8×8 grid which I want to use in order to plot some Z values in the contourf.

However, I interpolated my data to generate more point using griddata function. Now the number of values inside Z matrix ofcourse increases.

What I want to see on the contourf is the new Z matrix but with same (x,y) values. In this way the resolution will increase thanks to more datapoints in Z.

The problem is MATLAB asks for the same dimensions for (x,y) to produce corrosponding values in matrix Z.

Do you know how can I fix this?

Answer by Steven Lord
on 21 Aug 2019

contourf(Z)%this will give the contourf with increased x,y axis!

That's correct. What does contourf use as X and Y coordinates if you call it with only one input? From the documentation: "contourf(Z) creates a filled contour plot containing the isolines of matrix Z, where Z contains height values on the x-y plane. MATLAB® automatically selects the contour lines to display. The row and column indices of Z are the x and y coordinates in the plane, respectively."

When you called contourf on your coarser data you passed X and Y in, which "specifies the x and y coordinates for the values in Z." Pass the finer grid coordinates into contourf the same way.

Parham Ebrahimi
on 26 Aug 2019 at 8:16

Sign in to comment.

Opportunities for recent engineering grads.

Apply Today
## 2 Comments

## KALYAN ACHARJYA (view profile)

## Direct link to this comment

https://www.mathworks.com/matlabcentral/answers/477003-how-can-i-increase-the-resolution-of-contourf-plot#comment_737500

## Parham Ebrahimi (view profile)

## Direct link to this comment

https://www.mathworks.com/matlabcentral/answers/477003-how-can-i-increase-the-resolution-of-contourf-plot#comment_737518

Sign in to comment.