brush
Interactively mark data values in a chart
Description
Data brushing allows you to mark data values in a chart using a color of your choice. You can mark individual data values, or select many values to mark using a selection rectangle. Once you have values marked, you can delete them or save them to a variable in the workspace. Brush marks will persist until you remove them, even if you pan, zoom, add data tips, or edit the plot.
Most charts support data brushing, including line, bar, area, histogram, and surface charts. Charts that support brushing typically display the brush icon in the axes toolbar.
Creation
Description
brush on
turns on brushing in the current figure. With brushing
on, mark a single data value by clicking on it. Mark multiple data values by dragging a
selection rectangle around them. To add additional marks or remove unwanted marks, hold
the Shift key while brushing the values.
brush off
turns off brushing. If there are existing brush marks
on the chart, this command will not remove them.
brush
toggles the brush mode between on
and
off
.
brush(
sets the color for subsequent
brush marks. Setting the brush color does not affect current marks unless you brush
data, change the brush color, and then add or remove marks using the
Shift key. In this case, all marks update to the new color.color
)
brush(
sets the brush
mode for all axes in the specified figure for any of the previous syntaxes. Specify the
additional argument as fig
,___)'on'
, 'off'
, or a brush
mark color. For example, to enable brush mode for all axes in the figure
fig
, use brush(fig,'on')
. To set the brush mark
color for all of the axes, use brush(fig,'green')
.
brush(
sets the brush mode
for the specified axes. For example, to enable brush mode for the axes
ax
,___)ax
, use brush(ax,'on')
. To set the brush mark
color for the axes, use brush(ax,'green')
. Use this syntax with apps
created in App Designer and using the uifigure
function. (since R2023a)
Input Arguments
Properties
Examples
Limitations
Changing the color of brush marks using context menus is not supported for figures created
using the uifigure
function. Instead, create a brush mode
object and programmatically change its
color.
uif = uifigure; ax = axes(uif); bar(ax,1:10) b = brush(uif); b.Color = 'g'; b.Enable = 'on';
More About
Tips
To brush a histogram chart, you must first turn on data linking.
Alternative Functionality
Axes Toolbar
For some charts, enable brush mode by clicking the brush icon in the axes toolbar.