I am not especially experienced with MATLAB so this might be a dumb question, but I would appreciate any help that can be given.
I have some code that creates some axes, assigns a uicontextmenu to said axes, and then plots a graph of the user's choosing on the axes. The uicontextmenu is accessible by right-clicking on the graphs (as it should be) in every plot case it needs to EXCEPT for pcolor and contourf. Why would this be? Is there any way I can get around this?
Through extensive debugging I have found that the uicontextmenu is accessible until the pcolor (or contourf) functions are called and then it disappears. What am I missing?
EDIT: As requested, example code below. If you use pcolor the uicontextmenu won't appear and if you use plot then it will. I think it has something to do with the data the cursor is highlighting. If your cursor right clicks on plotted data, nothing appears in both. But why is this?
axes;
stuff = uicontextmenu('Parent',ancestor(axes,'figure'));
stuffm = uimenu('Parent',stuff,'Label','Change something');
set(axes,'uicontextmenu',stuff);
x = randn(10);
y1=randn(10,1);
y2=randn(10,1);
plot(y1,y2)
%pcolor(x)
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…