Question
I am trying to plot four plots in the same figure. First i plot using plotyy. Then two graphs are created, each with a y-axis. Now I want to plot another two plots. One using y-axis-1 and one using y-axis-2. How do i do this? If I do [ax,h1,h2] = plotyy(...) hold on plot(ax(1),...) plot(ax(2),...) i don't get all four plots.
Expert Answer
Neeta Dsouza
PhD Expert
Answered Aug 24, 2026
[ax,h1,h2] = plotyy(...) hold(ax(1)) plot(ax(1),...) hold(ax(2)) plot(ax(2),...)
The problem was simple, hold on just holds the current axes and your plotyy makes two axes so only one is the current.
100% Run Guarantee
3-Hour Fast-Track Delivery
Need a Custom Version or Complete Simulation for This Problem?
Our 500+ PhD engineers build, debug, and optimize working MATLAB scripts and Simulink (.slx) models tailored to your exact assignment rubrics with zero plagiarism.
Tested on MATLAB R2024b / R2026a
Turnitin 0% Plagiarism Report
Free 7-Day Revisions Guarantee
Have a different question? Ask here
Related MATLAB Questions & Solutions
Browse All →
Explore similar technical troubleshooting questions and verified MATLAB solutions:
Ready-to-Run MATLAB & Simulink Projects
Browse All Projects →