How to distinguish between multiple plots using yyaxis?
Show older comments
Hi all,
I am trying to create multiple plots from various data vectors in a live script, the code looks as follows:
yyaxis left %PLOT1 (1)
plot(x,data_1a)
ylabel('Volumenstrom [kg/h]');
yyaxis right %PLOT1 (2)
plot(x,data1b);
ylabel('Besucheranzahl [-]');
xlabel('Uhrzeit [hh:mm:ss]');
grid on;
yyaxis left; %PLOT2 (3)
plot(x,data2a);
ylabel('Volumenstrom [m³/h]');
yyaxis right; %PLOT2 (4)
plot(x,data2b);
ylabel('Besucheranzahl [-]');
xlabel('Uhrzeit [hh:mm:ss]');
grid on;
By using yyaxis I am plotting one data type on the left yaxis and the other on the right. However, Matlab creates a plot for each pair of yyaxis left and yyaxis right-calls. According to the numerators in brackets in the code above, the following plots are created:
plot (1)-(2), plot (2)-(3), plot (3)-(4)
Instead of only plot (1)-(2) and plot (3)-(4). How can I make it so that Matlab only creates these two plots i wish to obtain? I know there is work-around potential here but I would like to keep using the yyaxis command. I reckon there is some kind of "end plot"-command but i did not find anything yet.
Greetings!
Answers (0)
Categories
Find more on Exploration and Visualization 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!