Auto-tagging subtitles

I have 4 subtitles on the figure and want to call them a, b, c and d. I would like the letters to be placed automatically in the upper left corner of each subtitle. I know that I can add text manually, but is there a more efficient way to do this?

+3
source share
2 answers

You can put something along these lines in a script:

subplot(2,2,1)
text(0.02,0.98,'a','Units', 'Normalized', 'VerticalAlignment', 'Top')
subplot(2,2,2)
text(0.02,0.98,'b','Units', 'Normalized', 'VerticalAlignment', 'Top')
subplot(2,2,3)
text(0.02,0.98,'c','Units', 'Normalized', 'VerticalAlignment', 'Top')
subplot(2,2,4)
text(0.02,0.98,'d','Units', 'Normalized', 'VerticalAlignment', 'Top')

Please note that I am assuming that your subheadings are located in a 2x2 grid and that they are all 2D graphics. If these assumptions are not fulfilled, change the first two arguments of the subtask and / or add the z coordinate to the text.

+5
source

, , char:

% data:
myTriangle=(triang(100));
amplitudeFactor=[1 0.7 0.6  0.4 0.2];

% Plot, specifying number of lines in subplot:
nLine=2;
nPlot=length(amplitudeFactor);
for ind=1:nPlot
    subplot(nLine, ceil(nPlot/nLine),ind)
    plot(myTriangle*amplitudeFactor(ind))
    set(gca,'YLim',[0 1])
    text(0.02,0.98,char('a' + ind - 1),'Units', 'Normalized', 'VerticalAlignment', 'Top')
end
+2