How do I make and export a brushed area from a figure

10 views (last 30 days)
How do I make and export a brushed area from a figure

Answers (1)

Adam Danz
Adam Danz on 24 Feb 2025
Turn on brushing
To turn on brushing, press the brush icon in the axes toolbar or called the brush command: brush on.
Interactively extract brushed points
To interactively extract the brushed data points, right click a brushed data point and select "Export Brushed" from the context menu. A window will appear asking for a variable name to store in the workspace.
Programmatically export brushed points
Graphics objects contain a BrushData property that uses logical indexing to specify which coordinates in the object have been brushed. For example, if a scatter object has 5 coordinates and you brushed coordinates #2 and #3, then its BrushData property will be [0 1 1 0 0]. This can be used to index the Data properties. Here's an example.
s = scatter(rand(1,10), rand(1,10));
brush on
Select some coordinates
brushIdx = s.BrushData;
x = s.XData(brushIdx);
y = s.YData(brushIdx);

Categories

Find more on Graphics Performance in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!