Multiple Colormaps in one figure.

9 views (last 30 days)
Chirag Dudhat
Chirag Dudhat on 25 May 2019
Answered: Surbhi Pillai on 28 May 2019
I am trying to use multiple colormaps in one figure using subplot. but matlab only shows one colormap for all subplots. This is my code.
colormap01.png
m=8
n=9
%%
k=0;
for i=1:m
for j=1:n
a(j,i)=k;
k=k+1
end
end
a
colormap parula
subplot(4,5,1); image(a); title("parula")
colormap jet
subplot(4,5,2); image(a); title("jet")
colormap hot
subplot(4,5,4); image(a); title("hot")
colormap cool
subplot(4,5,5); image(a); title("cool")
colormap spring
subplot(4,5,6); image(a); title("spring")
colormap summer
subplot(4,5,7); image(a); title("summer")
colormap autumn
subplot(4,5,8); image(a); title("autumn")
colormap winter
subplot(4,5,9); image(a); title("winter")
colormap gray
subplot(4,5,10); image(a); title("gray")
colormap bone
subplot(4,5,11); image(a); title("bone")
colormap copper
subplot(4,5,12); image(a); title("copper")
colormap pink
subplot(4,5,13); image(a); title("pink")
colormap lines
subplot(4,5,14); image(a); title("lines")
colormap colorcube
subplot(4,5,15); image(a); title("colorcube")
colormap prism
subplot(4,5,16); image(a); title("prism")
colormap flag
subplot(4,5,17); image(a); title("flag")
colormap white
subplot(4,5,3); image(a); title("white")
colormap hsv
subplot(4,5,18); image(a); title("hsv")

Answers (1)

Surbhi Pillai
Surbhi Pillai on 28 May 2019
Hi Chirag,
Please find attached the link below that consists of a similar query on MATLAB Answers.
I hope this helps.

Community Treasure Hunt

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

Start Hunting!