I have 4 subplots in a figure and want to label them a, b, c, and d. I would like for the letters to be placed automatically in the top left hand corner of each subplot. I know that I can add text manually, but is there a more efficent way to do this?
You can put something along these lines into 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')
Note that I'm assuming your subplots are arranged in a 2x2 grid and that they are all 2D plots. If these assumptions do not hold, modify the first two arguments of subplot and/or add a z coordinate to text.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With