Interactively mark data values in a chart
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.
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 brushing 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 brush mode
or color options for the specified figure. For example,
fig
,___)brush(fig,'on')
.
creates a
b
= brush(___)brush
object. This syntax is useful for controlling the brush mode,
color, and callback properties.
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';
To brush a histogram chart, you must first turn on data linking.