File Exchange

image thumbnail


version 1.0.0 (60.1 KB) by Laurens R Krol
An adjustable multiple-colour gradient colour map for MATLAB

1 Download

Updated 17 Jul 2018

View License on GitHub

This script allows you to generate a colour scale (as for colormap, colorbar) using any number of custom colours, and allows you to arrange these colours by adjusting their relative positions with respect to each other, much like you may be used to creating gradients in e.g. Adobe Photoshop or CorelDRAW. It will automatically interpolate the colours in between the indicated anchor points. Interpolation can be done in both RGB and HSV space.

In its most basic form, simply call the script using an n-by-3 matrix of RGB values, and it will generate the colour map accordingly. For example, multigradient([1 0 0; 1 1 0; 0 1 0]) will return a map that blends from red through yellow to green, of the same size as the current figure's color map. Further tricks are optional.

Comments and Ratings (0)

MATLAB Release Compatibility
Created with R2018a
Compatible with any release
Platform Compatibility
Windows macOS Linux
Tags Add Tags

Discover Live Editor

Create scripts with code, output, and formatted text in a single executable document.

Learn About Live Editor