How to put two separate scales on the same x-axis?
3 views (last 30 days)
Show older comments
I would like to create a plot in MATLAB with two separate scales along the x axis. I need the negative x-axis to go from -15 to 0 and have intervals of 5 and the positive x-axis to go from 0 to 0.8 with intervals of 0.1. The plot needs to have the same x-axis as the image. Thank you.
2 Comments
Zachary
on 26 Oct 2023
I'm doing the same lab XD
Glad to see that an hour of searching MATLAB code led me to this.
Thanks Stephen! Good luck at UML
Walter Roberson
on 26 Oct 2023
It is not so difficult to create two adjacent axes with different scales, in a way that looks like a single continuous axes.
The tricky bit comes if you want to be able to pan or zoom or use datatips.
Answers (1)
William Rose
on 24 Oct 2022
1 Comment
William Rose
on 24 Oct 2022
Edited: William Rose
on 24 Oct 2022
@Stephen Bompastore, I did not read your quesiton carefully enough. I see that the quesiton which @dpb answered was different than what you are asking.
The info here should be adaptable to do what you want. THat site includes instructions for making the plot below:
I am confident that you can modify those instructions to make your plot.
See Also
Categories
Find more on 2-D and 3-D Plots in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!