Azzera filtri
Azzera filtri

Maximum scaling resolution of colormap for colorbar to be correct

7 visualizzazioni (ultimi 30 giorni)
I am experimenting with a function for using several colormaps in the same surface plot - e.g one colormap scaling for values < 0, another one for values between 0 and 1 and a third for values > 1.
I have used the following code as a proof of concept:
clear
clf('reset')
[x, y, z] = peaks(30);
surface(x, y, z);
n1 = 512;
n2 = 512;
cbar_mapping = [spring(n1); bone(n2)];
colormap(cbar_mapping);
colorbar
The function above generates the following figure.
In the final function I will set the values of variables n1, n2, ... , so that the relative contribution of each colormap will be assigned to the different regions of z, as described above. The higher the total value of n1 + n2+ ..., the better the range for each colormap will be pinpointed. However, if for instance I set n1 = 1024, n2 = 1024 in the code snippet above the colorbar will be faulty:
Questions: 1) Is this a bug, or a limitation implemented on purpose to fulfill another constraint?
2) Can the maximal sum of values n1 + n2 + ... be determined?
  8 Commenti
Hannes Mogensen
Hannes Mogensen il 4 Gen 2017
Modificato: Hannes Mogensen il 4 Gen 2017
@David Goodmanson: No, I haven't figured out why it sometimes looks as in the bottom figure. The maximum value that works sometimes differ for a single computer, depending on change in some parameters I have not pinpointed yet. If I figure out I will post here.
David Goodmanson
David Goodmanson il 5 Gen 2017
Thanks Hannes. I and several other folks will be interested to know what is going on once you find out.

Accedi per commentare.

Risposte (0)

Categorie

Scopri di più su Colormaps in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by