I'm working with GUI in Octave to plot three Y Axis and one X Axis.
My Problem is that one Plot hides another plot. Acutually it should have to show every graph. But it shows only the last one of my codes. I used hold on
and hold off
codes to show multiple y graphs. But it doesn't work like this e.
My code for plotting looks like this.
h1 = axes ('position', [0.45 0.25 0.5 0.5], 'tag', 'plotarea','ycolor','r');
plot( h1, XData, YData, 'tag', 'plotobject','color','r');
hold on
h2 = axes ('position', [0.45 0.25 0.5 0.5], 'tag', 'plotarea_1','ycolor','b');
plot( h2, XData, Y_1Data, 'tag', 'plotobject_1','color','b')
hold on
h3 = axes ('position', [0.45 0.25 0.5 0.5], 'tag', 'plotarea_2','ycolor','k');
plot( h3, XData, Y_2Data, 'tag', 'plotobject_2','k');
hold off
grid on
endfunction
Any help appreciated, or tips on where to look.
For the axes after the first one, set the color
property to none
and nextplot
property to add
:
h1 = axes ('position', [0.45 0.25 0.5 0.5], 'tag', 'plotarea','ycolor','r');
plot( h1, XData, YData, 'tag', 'plotobject','color','r');
% either after creating the axes:
h2 = axes ('position', [0.45 0.25 0.5 0.5], 'tag', 'plotarea_1','ycolor','b', 'color', 'none');
set(gca, 'nextplot', 'add')
plot( h2, XData, Y_1Data, 'tag', 'plotobject_1','color','b')
% or while creating the axes:
h3 = axes ('position', [0.45 0.25 0.5 0.5], 'tag', 'plotarea_2','ycolor','k', ...
'color', 'none', 'nextplot', 'add');
plot( h3, XData, Y_2Data, 'tag', 'plotobject_2','k');
grid on