TagPlot

PURPOSE ^

TagPlot adds IDs to figures

SYNOPSIS ^

function [figs, ID] = TagPlot(figs, prefix)

DESCRIPTION ^

TagPlot adds IDs to figures
   The ID is placed visual on the figure window and as Tag (Property of figure)
   TagPlot can tag multiple figures at once

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SUBFUNCTIONS ^

SOURCE CODE ^

0001 function [figs, ID] = TagPlot(figs, prefix)
0002 %TagPlot adds IDs to figures
0003 %   The ID is placed visual on the figure window and as Tag (Property of figure)
0004 %   TagPlot can tag multiple figures at once
0005 arguments
0006     figs (1,:) {mustBeFigure}
0007     prefix (1,:) {mustBeText}= ''
0008 end
0009 
0010 if isempty(prefix)
0011     warning('no project prefix defined')
0012 end
0013 
0014 for n = 1:numel(figs)
0015     ID = CreateID; % Create ID
0016     ID = [prefix,'-',ID]; % add Prefix
0017     axes = get(figs(n),'CurrentAxes'); % Axes object for text annotation
0018     % Limits for relative Positioning
0019     ylim =get(axes,'YLim');
0020     xlim =get(axes,'XLim');
0021     %ID
0022     text(axes,xlim(2),0.4*ylim(2), ID,'Fontsize',8,'Rotation',90,'VerticalAlignment','bottom',...
0023     'Color', 0.65*[1 1 1],'BackgroundColor','w');
0024     set(figs(n),'Tag', ID);
0025     
0026 end
0027 
0028 end
0029 
0030 function tf = mustBeFigure(h) %checks if input is a figure object
0031   tf = strcmp(get(h, 'type'), 'figure') & isa(h, 'matlab.ui.Figure');
0032 end

Generated on Tue 03-Aug-2021 18:32:18 by m2html © 2005