Data Brushing Callback; Assign (Keep) Brush Color
2 views (last 30 days)
Show older comments
Hi, I have created a callback function for data brushing (called with 'ActionPostCallback'). When I use the brush, I always set the color to Magenta ('Color',[1 0 1]) so that the brushed points are visible (some of my graphs contain red points, the default brush color).
However, when I the callback is used, the brush color is reset to the default red. I have tried setting the color ('MarkerEdgeColor') of the brush handle to magenta in the callback, but this results in an error (Below this paragraph). I think the error results from my trying to modify the brush handle inside of the callback for that handle.
Callback Error:
Warning: An error occurred during the mode callback.
> In uitools.uimode.fireActionPostCallback at 14
In datamanager.brushup at 114
In brush>@(es,ed)datamanager.brushup(es,ed)
In hgfeval at 63
In uitools.uimode.modeWindowButtonUpFcn at 46
In uitools.uimode.modeControl>localModeWindowButtonUpFcn at 155
My question is : Is there anyway for me to maintain my choice of brush color, or to assign a brush color inside of the callback? Thanks for the help!
Code For activating brushing:
hBrush = brush(figHandle);
set( hBrush,'ActionPostCallback', @(ohf, s) brushDataCallback, 'enable', 'on', 'Color', [1 0 1] )
Code in Callback to set color to Magenta
% Update All figures with Brushed Data
figHandles = findall(0,'Type','figure');
for ii = 1:length(figHandles)
brDataFig = findobj(figHandles(ii),'-property','BrushData');
set(brDataFig,'BrushData',brDataInd)
hb = findall(figHandles(ii),'Tag','Brushing');
set(hb,'MarkerEdgeColor',[1 0 1]);
% NOTE: I have also tried properties 'MarkerFaceColor' and 'Color', neither worked
end
Other References for Brushing: http://www.mathworks.com/help/matlab/ref/brush.html http://www.mathworks.com/matlabcentral/answers/8147
0 Comments
Answers (0)
See Also
Categories
Find more on Interactive Control and Callbacks in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!