MATLAB How can I position text on multiple Matlab plots with different scales?

Click For Summary
To position symbols (a), (b), and (c) consistently across three MATLAB plots with different scales, using the `text` function with normalized units is recommended. By setting the 'Units' property to 'normalized', the coordinates for the text can be specified relative to the plot dimensions, allowing for consistent placement. For example, using a position of [0.1 0.8] will place the symbols in the northwest corner of each plot. This method ensures that the symbols appear in the same location when the plots are overlaid, regardless of their individual scales.
hokhani
Messages
577
Reaction score
20
I want to have three plot 1,2,3 in Matlab with the symbols (a), (b) and (c) on plots 1, 2 and 3 respectively.I can do it by text('(a)'), text('(b)'), text('(c)') on the plot 1,2 and 3 respectively but I want to have the three symbols on the same position on the three plots for example northwest of all the plots. Since the three plots don't have the same scale, I can not do this by the command text(x,y,'(a)','FontSize',15) because I don't know the equivalent (x,y) on the three plots with different scales. In other words, I want the positions of the three symbols coincide when I put the three figures over each other.
 
Physics news on Phys.org
I believe you just need to use the Position and Units name value pairs for the text function.

If you use normalized units then the lower left becomes (0,0) and the top right (1,1).

http://www.mathworks.com/help/matlab/ref/text.html#inputarg_Position

I think it will look like this for top left (northwest), which would be something like [0.1 0.8] in normalized units:

Code:
text('Units', 'normalized', 'Position', [0.1 0.8], 'String', 'a/b/c')
 
Last edited:
  • Like
Likes hokhani and Greg Bernhardt

Similar threads

  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 32 ·
2
Replies
32
Views
4K
  • · Replies 2 ·
Replies
2
Views
4K
  • · Replies 7 ·
Replies
7
Views
2K
  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 11 ·
Replies
11
Views
3K
  • · Replies 1 ·
Replies
1
Views
2K