Does the latest version of Matlab allow more than one colormaps in one plot?

In the past, overlaying two axes was the only option, but overlaying can often causes its own problems, e.g., slight offset, etc.
Does anyone know if Matlab has fixed the issue?
Many thanks.

3 Kommentare

The colormap still belongs to the parent axes, so no, not as far as I can tell.
freezeColors() from the FIle Exchange can be very useful.
Many thanks for the recommendation. I'll check out freezeColors().

Melden Sie sich an, um zu kommentieren.

 Akzeptierte Antwort

Image Analyst
Image Analyst am 3 Nov. 2021
Bearbeitet: Image Analyst am 3 Nov. 2021
Nothing to fix. You can have only one colormap per axes control, but you can get around that by having basically two colormaps stacked on top of each other and adjust your data. For example if you have data that goes from 0 to 1023 (like a uint16 image) and want one colormap for gray levels 0-511 (say gray) and another (say, hsv) from 512 to 2013, you can do
cmap = [gray(512); hsv(512)]
imshow(yourImage, 'Colormap', cmap);

Weitere Antworten (0)

Kategorien

Mehr zu Color and Styling finden Sie in Hilfe-Center und File Exchange

Produkte

Version

R2021a

Gefragt:

am 2 Nov. 2021

Kommentiert:

am 3 Nov. 2021

Community Treasure Hunt

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

Start Hunting!

Translated by