In my GUI, I previously had several small axes, each of which was copied to a larger axes when the user clicked a specific small axes using buttondown. main parts of code:
function ButtonDown(hObject, eventdata, handles);
handles = guidata(hObject);
theaxes = ancestor(hObject,'axes');
if theaxes == handles.axes2;
plot....
However, I needed to use plotyy to create secondary y axes for some of the smaller plots. Doing this has disabled my buttondown function for said plots. How do I fix this? I have tried to manipulate 'hittest' property and 'clickableparts' to no avail.
Thanks

1 件のコメント

dpb
dpb 2015 年 10 月 8 日
I've never done anything with GUIs or callbacks but I'd guess your issue is that there are two axes handles generated by plotyy and you're not getting the callback assigned to each of them analogously as to your individual axes cases.

サインインしてコメントする。

回答 (1 件)

David
David 2018 年 3 月 28 日

0 投票

How are you setting the 'ButtonDownFcn' value for plotyy? It cannot be done in the function call itself, but it can be done by assigning the 'ButtonDownFcn' property to each axis directly:
[ax, h1, h2] = plotyy(xdata1, ydata1, xdata2, ydata2);
ax(1).ButtonDownFcn=@CallbackFunction;
Note: MATLAB only recognizes one callback function for the axes. If you assign a callback function to both axes, (i.e. ax(1) and ax(2)) only the function for ax(1) will be used.

カテゴリ

ヘルプ センター および File ExchangeTwo y-axis についてさらに検索

質問済み:

2015 年 10 月 8 日

回答済み:

2018 年 3 月 28 日

Community Treasure Hunt

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

Start Hunting!

Translated by