File Exchange

image thumbnail

Curly brace annotation

version 1.0.0.0 (1.9 KB) by Pål Næverlid Sævik
Draws curly brace on current figure

17 Downloads

Updated 22 Oct 2012

View License

DRAWBRACE Draw curly brace on current figure
DRAWBRACE([X1, Y1], [X2, Y2]) draws a curly brace from the point [X1,
Y1] to the point [X2, Y2]

DRAWBRACE([X1,Y1], [X2,Y2], W) draws a brace using the brace width W.

DRAWBRACE(..., 'Param1', 'Value1', 'Param2', 'Value2') draws a brace
using the LineSeries property values specified by 'Param1'/'Value1',
'Param2'/'Value2', ... .

H = DRAWBRACE(...) returns the LineSeries handle to the brace.

Example:
H = drawbrace([0 0], [1 1], 20, 'Color', 'k')

Comments and Ratings (15)

I also wanted the brace to point downward, so I tried reversing x1 and x2 (e.g., drawbrace([2 1],[1 1]) instead of drawbrace([1 1],[2 1])). It worked.

KAE

Really useful. Should be built in. Here is a way to use mouse clicks to determine the placement of a horizontal brace (left to right).
x = ginput(2); % Click on the left and right location you want the brace to cover
h = drawbrace([x(1,1) x(1,2)], [x(2,1) x(1,2)]); % Plot the brace
set(h, 'clipping', 'off', 'color', 'k'); % Change some of the line properties

I works very well; thanks.

How can I have the curly brace pointing downwards?

maximus

i like it! i guess it wouldn't be hard to do it, but it would be nice to have a property if the curly bracket looks upward or downward.

Philippe

Very useful!

Monica

Hannu K

Thanks for the nice submission.

Add the possibility to give z-coordinates as well to produce 3d braces and I'll upgrade to 5 stars.

hu

Hi,

I was using your drawbrace function and it is very useful, can you also implement a parameter to control the height of the curly brace?

Thanks.

MATLAB Release Compatibility
Created with R2011a
Compatible with any release
Platform Compatibility
Windows macOS Linux