Commit 3fcd1b4e authored by p.jhagema's avatar p.jhagema
Browse files

addScalebar: option to adjust offset between bar and label

parent 5c823582
Pipeline #265405 passed with stage
in 43 seconds
......@@ -28,6 +28,9 @@ function scalebar = addScalebar(scalebarLength, pixelsize, settings)
% the label is '<scalebarLength> micron'.
% fontSize : Default = 12
% Font size of the scalebar label.
% offset: Default = 18
% Offset between scalebar and label. Default value equals 1.5 times the
% FontSize
%
% Returns
% -------
......@@ -77,6 +80,7 @@ defaults.scalebarColor = 'k';
defaults.scalebarWidth = 4;
defaults.scalebarText = [];
defaults.fontSize = 12;
defaults.offset = 18;
if (nargin == 0)
scalebar = defaults;
......@@ -101,7 +105,8 @@ posScalebarY = figureAxes(4) * settings.posY;
line([posScalebarX posScalebarX-scalebar],[posScalebarY posScalebarY],'LineWidth',...
settings.scalebarWidth,'Color',settings.scalebarColor);
text(posScalebarX - 0.5*scalebar, posScalebarY - 15. * settings.scalebarWidth, settings.scalebarText,...
text(posScalebarX - 0.5*scalebar, posScalebarY - settings.offset - settings.fontSize, settings.scalebarText,...
'Color',settings.scalebarColor , 'FontSize',settings.fontSize,...
'HorizontalAlignment', 'center')
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment