Just one y axis is drawn in GUI when I use the plotyy.

3 ビュー (過去 30 日間)
octopus_love
octopus_love 2017 年 9 月 15 日
コメント済み: octopus_love 2017 年 9 月 18 日
Hello, I have questions about 'plotyy'.
For example, code is like this in 'plotting_graph.m'. It is used for drawing graph.
[hAx, hLine1, hLine2] = plotyy(axis_x, (table(:, 1)/scale_value), axis_x, table_cumsum(:, 2));
And, at 'graph.m'(GUI code) I intend to enlarge the figure when I click the right button on mouse.
but when I click the right button, only one y axis is exist on the enlarged figure window.
function plot_ax1_Callback(hObject, eventdata, handles)
% Displays contents of axes1 at larger size in a new figure
global plotyy_flag;
if (plotyy_flag == true)
axes1fig = figure;
% Copy the axes and size it to the figure
axes1copy = copyobj(handles.axes1,axes1fig);
set(axes1copy,'Units','Normalized', 'Position',[.05,.2,.9,.6]);
set(axes1copy, 'FontSize', 9);
hold on;
% Save handles to new fig and axes in case
% we want to do anything else to them
handles.axes1fig = axes1fig;
handles.axes1copy = axes1copy;
guidata(hObject,handles);
end
how can I bring the 2 yyaxis on the new figure window? please help me.
when I use the 'guidata(hObject, handles)', it doesnt't work.

採用された回答

Henry Giddens
Henry Giddens 2017 年 9 月 16 日
編集済み: Henry Giddens 2017 年 9 月 16 日
Hi,
plotyy creates two axes objects. You need to copy both to the new figure. Are you sure that your code is copying both objects? Is 'handles.axes1' a single axes object or does it contain 2 entries?
You should have both axes objects in hAx from the first line of code:
[hAx, hLine1, hLine2] = plotyy(axis_x, (table(:, 1)/scale_value), axis_x, table_cumsum(:, 2));
Make sure you are copying both objects in hAx to the new figure
  1 件のコメント
octopus_love
octopus_love 2017 年 9 月 18 日
Thanks. Maybe, It is because of the dealing with 2 handles on the axes. My solution is : making the axis information(hAx) to global variables. And I used it the 'plot_ax1_Callback'.
Many thanks to advice me.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeTwo y-axis についてさらに検索

Community Treasure Hunt

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

Start Hunting!