How to save a new modified colormap ?

Hi, I have been using the 'jet' colormap to display my figures, but I want to make a minor modification. I want to set the 0 values to be black. I changed this by setting the middle rows in the existing colormap data to zero.
mymap = jet; mymap(32:33,:)=0;
how do I save this new colormap called 'mymap', so that I can use it as a colormap?

Answers (1)

Adam
Adam on 29 Jul 2016
Edited: Adam on 29 Jul 2016
filename = 'C:\Me\colourmaps\myColourmap.mat';
save( filename, 'mycmap' );
Obviously filename is whatever you choose it to be, but should ideally be a full path. It doesn't have to be, if not it will be saved in the current directory, but I prefer to be explicit.

2 Comments

Hi Adam, and how to call this file again to use it please
loadedData = load( filename, 'mycmap' );
colormap( hAxes, loadedData.mycmap );
where hAxes is your axes handle

Sign in to comment.

Categories

Asked:

on 29 Jul 2016

Commented:

on 6 Sep 2018

Community Treasure Hunt

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

Start Hunting!