0
0
MATLABdata~10 mins

Colormap and colorbar in MATLAB - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to create a colormap with 64 colors.

MATLAB
cmap = [1](64);
Drag options to blanks, or click blank then click option'
Aaxis
Bplot
Cjet
Dfigure
Attempts:
3 left
💡 Hint
Common Mistakes
Using plotting functions instead of colormap functions.
Confusing figure or axis commands with colormap.
2fill in blank
medium

Complete the code to add a colorbar to the current figure.

MATLAB
[1];
Drag options to blanks, or click blank then click option'
Acolorbar
Bcolormap(jet)
Caxis equal
Dhold on
Attempts:
3 left
💡 Hint
Common Mistakes
Using colormap instead of colorbar.
Trying to set axis properties instead of adding colorbar.
3fill in blank
hard

Fix the error in the code to apply the 'hot' colormap and show the colorbar.

MATLAB
imagesc(peaks(20))
[1]('hot')
colorbar;
Drag options to blanks, or click blank then click option'
Acolormap
Bcolorbar
Ccaxis
Daxis
Attempts:
3 left
💡 Hint
Common Mistakes
Using colorbar instead of colormap.
Trying to use axis or caxis incorrectly.
4fill in blank
hard

Fill both blanks to create a figure with a 'parula' colormap and add a colorbar.

MATLAB
imagesc(magic(10))
[1]([2])
colorbar;
Drag options to blanks, or click blank then click option'
Acolormap
Bparula
Cjet
Dcolorbar
Attempts:
3 left
💡 Hint
Common Mistakes
Using colorbar as the colormap function.
Confusing colormap names.
5fill in blank
hard

Fill all three blanks to create a heatmap with a 'cool' colormap, set color limits, and add a colorbar.

MATLAB
data = rand(5);
imagesc(data)
[1]([2])
caxis([3])
colorbar;
Drag options to blanks, or click blank then click option'
Acolormap
Bcool
C[0 1]
Djet
Attempts:
3 left
💡 Hint
Common Mistakes
Using colorbar instead of colormap.
Incorrect color limits format.