What is the fastest way to plot 4 separate graphs with equal y parameters?

조회 수: 7 (최근 30일)
ampaul
ampaul 2017년 6월 23일
댓글: Walter Roberson 2017년 6월 23일
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
Walter Roberson
Walter Roberson 2017년 6월 23일
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.

댓글을 달려면 로그인하십시오.

답변 (1개)

Adam
Adam 2017년 6월 23일
편집: Adam 2017년 6월 23일
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.

카테고리

Help CenterFile Exchange에서 Subplots에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by