Info

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

How do I define Limits of Colors in a Colorbar?

1 view (last 30 days)
Olivier Gouveia
Olivier Gouveia on 24 Sep 2015
Closed: MATLAB Answer Bot on 20 Aug 2021
Hi, I'm actually doing a 3D surface plot where I have N and Q as inputs and Re as my output. I wish to represent my output Re using 2 colors in my colorbar, as the following: 0 to 2400 - Green and >2400 - Red. How can I do that?

Answers (1)

Walter Roberson
Walter Roberson on 24 Sep 2015
surf(N, Q, Re, double(Re>2400));
colormap([0 0 1; 1 0 0]);

Community Treasure Hunt

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

Start Hunting!