How to save a new modified colormap ?
Show older comments
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)
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
Mostafa Ibrahim
on 5 Sep 2018
Edited: Mostafa Ibrahim
on 5 Sep 2018
Hi Adam, and how to call this file again to use it please
Adam
on 6 Sep 2018
loadedData = load( filename, 'mycmap' );
colormap( hAxes, loadedData.mycmap );
where hAxes is your axes handle
Categories
Find more on Color and Styling in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!