Data Brushing Callback; Assign (Keep) Brush Color

2 次查看(过去 30 天)
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

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Interactive Control and Callbacks 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by