Skip to content
Snippets Groups Projects

Closes #56, Fixes #68

Merged Lemmer, Jan requested to merge 68-label-position-und-rotation into development
1 file
+ 18
9
Compare changes
  • Side-by-side
  • Inline
+ 18
9
@@ -14,10 +14,11 @@ function [figs, IDs] = TagPlot(figs, options)
arguments
figs (1,:) {mustBeFigure}
options.ProjectID (1,:) {mustBeText}= ''
options.Fontsize (1,1) {mustBeInteger} = 8
options.Fontsize (1,1) {mustBeInteger} = 8
options.Color (1,3) {mustBeNonnegative} = 0.65*[1 1 1] % grey
options.Location (1,:) {mustBeText} = 'east'
options.Position (1,2) {mustBeVector} = [1,0.4] % default for east
options.Rotation (1,1) {mustBeInteger} = 0
options.Rotation (1,1) {mustBeReal} = NaN
end
if isempty(options.ProjectID)
@@ -41,16 +42,19 @@ end
switch options.Location
case 'north'
options.Position = [0.4,0.95];
options.Rotation = 0;
Rotation = 0;
case 'east'
options.Position = [1,0.4];
options.Rotation = 90;
Rotation = 90;
case 'south'
options.Position = [0.4,.02];
options.Rotation = 0;
Rotation = 0;
case 'west'
options.Position = [.05,0.4];
options.Rotation = 90;
Rotation = 90;
case 'southeast'
options.Position = [0.8,.02];
Rotation = 0;
case 'custom'
% Check if Position is valid
if ~all(0 <= options.Position & options.Position <= 1)
@@ -62,6 +66,10 @@ switch options.Location
options.Location = 'east'; options.Position = [1,0.4];
end
if ~isnan(options.Rotation)
Rotation = options.Rotation;
end
IDs = cell(numel(figs),1);
for n = 1:numel(figs)
@@ -72,10 +80,11 @@ for n = 1:numel(figs)
ylim =get(axes,'YLim');
xlim =get(axes,'XLim');
%ID
position = [options.Position(1)*xlim(2), options.Position(2)*ylim(2)];
position = [options.Position(1), options.Position(2)];
text(axes,position(1),position(2), IDs{n},'Fontsize',options.Fontsize,...
'Rotation',options.Rotation, 'VerticalAlignment','bottom','Color',...
0.65*[1 1 1],'BackgroundColor','w');
'Rotation',Rotation, 'VerticalAlignment','bottom','Color',...
options.Color,'BackgroundColor','w', 'Units', 'normalized');
set(figs(n),'Tag', IDs{n});
end
Loading