image thumbnail

plotScalingInfo – Add scaling / dimensioning arrow to plot

version 1.1.0 (2.6 KB) by Daniel Frisch
Draws a true to scale arrow that shows the scaling. Useful when y axis tick labels are to be omitted.

14 Downloads

Updated 14 Nov 2020

View License

plotScalingInfo – Add scaling / dimensioning arrow to plot

Draws a true to scale arrow that shows the scaling. Useful when y axis tick labels are to be omitted.

This function adds a scaling information to a plot.
The arguments are property-value pairs.
All of them are optional; default values will be used then.

Use cases:
- Plot many channels vertically stacked (non-overlapping) as with plotECG()
- y axis has no natural origin (zero), only differences matter
- want to omit y axis ticks & tick labels for more clarity

Attention: The scaling information does not update if you zoom the axes!
The position of the scaling information is fixed in normalized units relative to the figure.

Properties:
'Axes' : Axes handle (default: gca)
'Size' : Size of the scaling info relative to axis data units (default: 1)
'String' : Information string (default: '')
'Position' : (1 x 2) vector with the position relative to axes: [x,y] (default: [0.97,0.12])
'HeadSize' : (1 x 2) vector with the rectangular head size: [width,length] (default: [15,1])
'LineWidth' : Line width (default: 2)
'Color' : Line color (default: 'black')
'FontSize' : Font size (default: 20)

Output arguments:
- hnd(1) : handle of doublearrow annotation
- hnd(2) : handle of textarrow annotation

Usage example:
>> figure; plot(1:10)
>> hnd = plotScalingInfo('Size',5, 'String','5mV', 'Position',[0.9,0.2]);
>> hnd(2).VerticalAlignment = 'top';

Cite As

Daniel Frisch (2021). plotScalingInfo – Add scaling / dimensioning arrow to plot (https://www.mathworks.com/matlabcentral/fileexchange/82818-plotscalinginfo-add-scaling-dimensioning-arrow-to-plot), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2020b
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

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

Start Hunting!