percentlabel

Converts axis tick labels and contour line labels to percentages
71 téléchargements
Mise à jour 5 oct. 2016

Afficher la licence

PERCENTLABEL: Converts axis tick labels and contour line labels to percentages
Syntax:

percentlabel(h); Attempts to add a % symbol to all all
tick labels of the handle h

percentlabel(h, OptionName, OptionValue); With additional
options

clab = percentlabel(h); Return labels of
contour lines

Input arguments:

h: Figure or Axes handle.
It is recommended
to call this
function on an axes
handle.

Option-Value pairs

OptionName: OptionValue: Explanation:

'X' 'none' - Ignore x axis ticks
'normalized' - Convert from [0,1]-normalized XTickLabels
'absolute' (default) - add symbol without conversion

'Y' 'none' - Ignore y axis ticks
'normalized' - Convert from [0,1]-normalized YTickLabels
'absolute' (default) - add symbol without conversion

'C' 'none' - Ignore colorbar ticks
'normalized' - Convert from [0,1]-normalized colorbar TickLabels
'absolute' (default) - add symbol without conversion

Example:

percentlabel(gca, 'X', 'normalized', 'C', 'absolute')
--> converts normalizeden XTickLabels to percentages and adds a
percent symbol to the colorbar TickLabels

Option-Value pairs for contour line labels:

OptionName: OptionValue: Explanation:

'L' 'autoline' (default) - automatically add contour line labels
[xl, yl] - adds contour line labels to the coordinates at [xl, yl]
xl and yl are vectors containing
the X- and Y-coordinates of
the labels and must be combined into a
matrix.

'LMode' 'normalized' - converts normalized labels into percentages
'absolute' (default) - adds percentage symbols without conversion

'LAngle' 'default' (default) - add the labels centered from top left to bottom right
alpha - add the labels according to the
nearest points of a square cross section
with the angle alpha (starting from the
center)

Examoples:

clab = percentlabel(gca, 'L', 'autoline', 'LMode', 'absolute');
--> Automatic generation of contour line labels absolute
data

percentlabel(gca, 'L', [(x1; x2; x3), (y1; y2; y3)], 'LMode', 'normalized');
--> generates the labels at the coordinates set by
[xl,yl], where xl = [x1;x2;x3] and yl = [y1;y2;y3]
The data that is normalized to [0, 1] are converted into
percentages

percentlabel(gca, 'L', 'autoline', 'LAngle', -45)
--> Sets the labeling at an angle of approx. -45°.

Output argument:

clab: (optional) Cell-Array containing the text
objects of the contour line labels

Hint:
Percentlabel-Contour line labels can be found by typing:
findobj(gca,'Tag','percentlabel);

Author: Marc Jakobi - 18.06.2015

Citation pour cette source

Marc Jakobi (2024). percentlabel (https://www.mathworks.com/matlabcentral/fileexchange/59508-percentlabel), MATLAB Central File Exchange. Récupéré le .

Compatibilité avec les versions de MATLAB
Créé avec R2016b
Compatible avec toutes les versions
Plateformes compatibles
Windows macOS Linux
Remerciements

Inspiré par : C2xyz contour matrix to coordinates

Community Treasure Hunt

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

Start Hunting!
Version Publié le Notes de version
1.0.0.0