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

In summary, The conversation discusses how to have three plots in Matlab with symbols (a), (b), and (c) on plots 1, 2, and 3 respectively. The speaker suggests using the text function with the Position and Units name value pairs to align the symbols in the same position on the plots, using normalized units to specify the position.
  • #1
hokhani
483
8
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
  • #2
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

1. How can I adjust the position of text in a Matlab plot?

To adjust the position of text in a Matlab plot, you can use the 'Position' property of the text object. This property takes in a four-element vector [x, y, z] where x and y represent the coordinates of the text in the plot, and z represents the layer in which the text is placed. You can also use the 'HorizontalAlignment' and 'VerticalAlignment' properties to further fine-tune the position of the text.

2. Why is my text not showing up in my Matlab plot?

If your text is not showing up in your Matlab plot, it could be due to a few reasons. Firstly, make sure that the text object has not been hidden or deleted accidentally. Additionally, check the 'Visible' property of the text object to ensure that it is set to 'on'. Finally, check the 'Z' value of the text's position to make sure it is not behind other objects in the plot.

3. Can I rotate text in a Matlab plot?

Yes, you can rotate text in a Matlab plot using the 'Rotation' property of the text object. This property takes in an angle value in degrees and rotates the text counter-clockwise around its anchor point. You can also use the 'HorizontalAlignment' and 'VerticalAlignment' properties to control the orientation of the text.

4. How do I create multiple lines of text in a Matlab plot?

To create multiple lines of text in a Matlab plot, you can use the 'String' property of the text object. This property takes in a cell array of strings, with each cell representing a separate line of text. You can also use the 'FontSize' and 'FontWeight' properties to differentiate between the lines of text.

5. Is it possible to change the font of text in a Matlab plot?

Yes, you can change the font of text in a Matlab plot by using the 'FontName' property of the text object. This property takes in a string that represents the name of the font you want to use. You can also use the 'FontSize' and 'FontWeight' properties to further customize the appearance of the text.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
32
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
7
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
11
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
1K
Back
Top