Info

This question is closed. Reopen it to edit or answer.

What function has created this plot?

3 views (last 30 days)
Orla Lennon
Orla Lennon on 16 Apr 2020
Closed: MATLAB Answer Bot on 20 Aug 2021
Sorry for blurriness but can anyone tell me what function they think this plot was created using? Would it be imagesc?
I need to plot something very similar where I have a function that varies at each x and y point and I need to represent it using colour.
If you could tell me what function to use and outline the general steps for plotting that would be very much appreciated.
In particular I'm interested in how the plot has curves and smooth edges rather than a 'boxy' pixel images that Matlab show on their doc page for imagesc (second picture).
Thanks in advance!

Answers (1)

Star Strider
Star Strider on 16 Apr 2020
The top image appears to be a contour plot, although it could be a surf plot rotated with view to see it from the top.
There are several different contour functions (by the same name) in different Toolboxes, so it could have been drawn by them as well as the core MATLAB contour function I linked to.
  2 Comments
Orla Lennon
Orla Lennon on 16 Apr 2020
Contour(x,y,z) seems to have strict restrictions on what Z can be. i.e. it must be at least a 2x2 matrix and have the same number of columns as x and rows as y. I just have 3 vectors x,y and z, all of same length and I want to plot the third as colour.
Star Strider
Star Strider on 16 Apr 2020
The contour and surf functions need ‘Z’ to be a matrix.
It could be that your data are already gridded, and you would only need to reshape them.
If they are not gridded, use the griddata function to interpolate your ‘z’ vector to a matrix.

This question is closed.

Community Treasure Hunt

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

Start Hunting!