som_recolorbar
Purpose
Refreshes the the colorbars in the figure.
Syntax
h = som_recolorbar
h = som_recolorbar(p)
h = som_recolorbar(p, ticks)
h = som_recolorbar(p, ticks, scaling)
h = som_recolorbar(p, ticks, scaling, labels)
Description
This function refreshes the colorbars in the figure created by SOM_SHOW.
Refreshing is necessary if you have changed the colormap. Each colorbar
has letter 'd' or 'n' and possibly 'u' as label. Letter 'd' means that the
scale is denormalized, letter 'n' that the scale is normalized, and 'u' is
for user specified labels.
Different argument combinations:
1. Argument 'ticks' has string values:
- 'auto' for input argument ticks sets the automatic tick
marking on (factory default).
- 'border' sets the tick marks to the color borders. This is
convenient if there are only few colors in use.
Argument scale controls the scaling of the tick mark label values.
'normalized' means that the tick mark labels are directly the values
of the ticks, that is, they refer to the map codebook values.
Value 'denormalized' scales the tick mark label values back to the original
data scaling. This is made using som_denormalize_data.
2. Argument 'ticks' is a cell array of vectors:
The values are set to be the tick marks to the colorbar specified by p.
- if arg. scale is 'normalized' the ticks are set directly to the colorbar.
- if arg. scale is 'denormalized' the tick values are first normalized
in the same way as the data.
3. Argument 'ticks' is a vector
As above, but the same values are used for all (given) subplots.
4. Argument 'ticks' is a scalar
The ticks are set to equally spaced values between (and including)
minimum and maximum.
Argument 'labels' specify user defined labels to the tick marks
NOTE: ticks are rounded to contain three significant digits.
Optional input arguments
p (vector) subplot number vector
(string) 'all' (the default), 'comp' to effect only
component planes
ticks (string) 'auto' or 'border', default: 'auto'
(cell array) p x 1 cell array of p row vectors
(vector) as the cell array, but the same vector is
applied to all given subplots
(scalar) the number of ticks to show: these are
evenly space between minimum and maximum
scale (string) 'denormalized' or 'normalized' (the default)
labels (cell array) p x 1 cell array of cells containing strings
Output arguments
h (vector) handles to the colorbar objects.
Example
colormap(jet(5)); som_recolorbar('all','border','denormalized')
% Uses five colors and sets the ticks on the color borders.
% Tick label values are denormalized back to the original data scaling
colormap(copper(64));som_recolorbar
% changes to colormap copper and resets default ticking and labeling
som_recolorbar('all',3)
% To put 3 ticks to each colorbar so that minimum, mean and
% maximum values on the colorbar are shown.
som_recolorbar([1 3],{[0.1 0.2 0.3];[0.2 0.4]},'denormalized')
% Ticks colorbar 1 by first normalizing values 0.1, 0.2, 0.3 and
% then setting the ticks to the colorbar. Labels are of course
% 0.1, 0.2 and 0.3. Ticks colorbar 3 in the same way using values
% 0.2 and 0.4.
som_recolorbar([2 4],{[0.1 0.2];[-1.2 3]},'normalized',{{'1' '2'};{'a' 'b'}})
% Ticks colorbar 2 and 4 directly to the specified values. Sets labels
% '1' '2' and 'a' 'b' to the ticks.
som_recolorbar([2 4],{[0.1 0.2];[-1.2 3]},'normalized',{{'1' '2'};{'a' 'b'}})
% as previous one, but normalizes tick values first
See also