Rescaling the x axes and y axes for each plot separately?

1 view (last 30 days)
Dear all,
I am having trouble adjusting the scaling of the x axis and y axis in the codes. I have tried a lot and can't figure it out. That's why I hope to find the solution here.
I would like to change the x and y axes for each variable separately, so that for example the variable s is represented in an x=(0;20) and y=(0; 1) space, while the variable pi is represented in an x=(0;20) and y=(0; 5) space.
At the moment the output looks like this:
And those are the codes I'm using:
Can anyone tell me what I have to do ?
Many thanks for your help!

Accepted Answer

Cris LaPierre
Cris LaPierre on 19 Oct 2022
Add an call to the axis function in each subplot with the desired X and Y scaling using the syntax:
For example,
axis([0 20 0 1])
If you want to do it all in a single loop like you have, predefine your limits and then extract the corresponding row.
lmt = [0 20 0 1; 0 20 0 5]
for jj = ...
plot...
axis(lmt(jj,:))
end

More Answers (0)

Community Treasure Hunt

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

Start Hunting!