brace_vertical#
- named_arrays.plt.brace_vertical(x, width, ymin, ymax, ax=None, label=None, beta=None, kind='left', kwargs_plot=None, kwargs_text=None, **kwargs)#
Plot a vertical curly bracket at the given coordinates.
- Parameters:
x (float | u.Quantity | na.AbstractScalar) – The horizontal position of the vertical curly bracket.
width (float | u.Quantity | na.AbstractScalar) – The width of the curly bracket in data coordinates.
ymin (float | u.Quantity | na.AbstractScalar) – The minimum span of the vertical curly bracket.
ymax (float | u.Quantity | na.AbstractScalar) – The maximum span of the vertical curly bracket.
ax (None | matplotlib.axes | na.AbstractScalar) – A matplotlib axes instance on which to plot the curly bracket.
label (None | str | na.AbstractScalar) – The optional text label for the curly bracket.
beta (None | float | na.AbstractScalar) – Parameter which controls the “curlyness” of the bracket. If
None,beta = 2 / width.kind (Literal['left', 'right']) – The kind of the brace, left or right.
kwargs_plot (None | dict[str, Any]) – Additional keyword arguments that are passed to
plot().kwargs_text (None | dict[str, Any]) – Additional keyword arguments that are passed to
text().kwargs – Additional keyword arguments that are passed to both
plot()andtext().
- Return type:
na.AbstractScalar
Examples
Plot an array of braces with different lengths
import matplotlib.pyplot as plt import named_arrays as na # Define the number of braces to plot num = 5 # Define the x coordinate of the braces x = na.linspace(0.2, 0.9, axis="y", num=num) # Define the y ranges of the braces ymin = -na.linspace(.3, .8, axis="y", num=num) ymax = +na.linspace(.3, .8, axis="y", num=num) # Define the label as the length of the brace label = ymax - ymin # Plot the braces fig, ax = plt.subplots() na.plt.brace_vertical( x=x, width=0.05, ymin=ymin, ymax=ymax, ax=ax, kind="left", label=label, ); ax.set_xlim(0, 1); ax.set_ylim(-1, 1);