percentlabel

版本 1.0.0.0 (4.4 KB) 作者: Marc Jakobi
Converts axis tick labels and contour line labels to percentages
71.0 次下载
更新时间 2016/10/5

查看许可证

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

引用格式

Marc Jakobi (2024). percentlabel (https://www.mathworks.com/matlabcentral/fileexchange/59508-percentlabel), MATLAB Central File Exchange. 检索来源 .

MATLAB 版本兼容性
创建方式 R2016b
兼容任何版本
平台兼容性
Windows macOS Linux

Community Treasure Hunt

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

Start Hunting!
版本 已发布 发行说明
1.0.0.0