Just one y axis is drawn in GUI when I use the plotyy.
3 views (last 30 days)
Show older comments
octopus_love
on 15 Sep 2017
Commented: octopus_love
on 18 Sep 2017
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.
0 Comments
Accepted Answer
Henry Giddens
on 16 Sep 2017
Edited: Henry Giddens
on 16 Sep 2017
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
More Answers (0)
See Also
Categories
Find more on Two y-axis in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!