matlab - generate rectangle annotation in the current figure -
I would like to insert a rectangle in my matlab shape to highlight a specific area:
X = [0 1 2 2 3 4 5 6 7 8 9 10]; Y = [0 1 2 4 3 4 5 6 7 8 9 10]; FH = shape (1); Plot (x, y) xlim ([0 10]); Ylim ([0 10]); I can define the height of the width of the rectangular oblique by using the annotation function.
I am thinking, can this question figure be done according to x and y values? For example, for example, I want to draw a rectangle of x = 1.5 y = 1.5 with the height of 3 x and the width of two. This is my endeavor:
In the case of% x and y, determine the position of the lbwh l = 1.5; B = 1.5; w = 2; H = 3; Convert Factor of% 1 xx = xlim; L = l./xx (2); B = B / X (2); W = w./xx (2); H = h. / X (2); Annotation ('rectangle', 'position', [L, B, W, H]); The problem is that the situation I am providing is in the context of the position (0,0) in the plot and the shape is not in the lower left hand side of the window. How can I correct this?
In a way, just to make a rectangle with the articles of the line:
< Code> Plot ([L, L, L + W, L + W, L], [B, B + H, B + H, B, B], 'R', 'linewidth', 2)
Comments
Post a Comment