MATLAB Answers

Reverse the Colormap of Surf plot

160 views (last 30 days)
James on 26 May 2020
Commented: James on 26 May 2020
I'm constructing a surf plot using Location (logitude, latitude) and depth data. Following image is the 2D projection of my surf plot. Is there a way to reverse the colormap of my plot?
i.e. Highest values should be shown in Dark blue (instead of yellow) and lowest values should be shown in yellow (instead of blue).
Thanks in advance!

Accepted Answer

Tommy on 26 May 2020
Grab the colormap and flip it upside down:
f = figure;
colormap(f, flipud(colormap(f)))
  1 Comment
James on 26 May 2020
Just what I needed! Thanks, Tommy.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!

Translated by