What is the fastest way to plot 4 separate graphs with equal y parameters?
26 views (last 30 days)
Show older comments
Hello,
I am trying to plot 4 graphs. Each of these need to be on a similar scale, so I would like them all to have y boundaries of -50 to 50.
Here is what I have in my workspace.
>> subplot(2,2,1)
>> plot(1:length(x),x(6,:))
>> subplot(2,2,2)
>> plot(1:length(y),y(6,:))
>> subplot(2,2,3)
>> plot(1:length(z),z(6,:))
>> subplot(2,2,4)
>> plot(1:length(f),f(6,:))
This produces:
I would like all graphs to have a fixed height of 100.. from -50 to 50 on the y axis. How can I accomplish this? Thanks
1 Comment
Walter Roberson
on 23 Jun 2017
Define "fastest" in this context. Indicate your MATLAB release, your operating system and exact list of patches installed, and complete hardware specifications for your CPU, memory, graphics subsystem, graphics driver, monitor, hard drive, hard drive interface, and list all other devices that share the same bus. Describe your antivirus system.
Test your typing speed for code composition.
... Because all of these factors can affect the speed of either creating the appropriate code or executing the code once you have it.
We might possibly be able to advise you on the ten or so hour system optimization process needed to be able to draw your plots 6 nanoseconds faster.
Answers (1)
Adam
on 23 Jun 2017
Edited: Adam
on 23 Jun 2017
hAxes(1) = subplot(2,2,1);
plot( hAxes(1), 1:length(x),x(6,:))
hAxes(2) = subplot(2,2,2);
plot( hAxes(2), 1:length(y),y(6,:))
hAxes(3) = subplot(2,2,3);
plot( hAxes(3), 1:length(z),z(6,:))
hAxes(4) = subplot(2,2,4);
plot( hAxes(4), 1:length(f),f(6,:))
set( hAxes, 'YLim', [-50 50] )
If you wish them to retain the same Y limits if you zoom in one plot then
linkaxes( hAxes, 'y' )
should achieve this.
0 Comments
See Also
Categories
Find more on Subplots 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!