offset on y-axis
36 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Doyinsola
am 23 Jan. 2024
Verschoben: Dyuman Joshi
am 24 Jan. 2024
Hi all,
I have a two datasets I had plotted on a single y-axis and x-axis. I need help on how to achieve the below plot idea. I have attached my plot and the plot idea I want to achieve (both normalized and not normalized). Thank you
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1597531/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1597536/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1597541/image.png)
3 Kommentare
Akzeptierte Antwort
Star Strider
am 23 Jan. 2024
To plot them all on the same axes, you would need to offset them by some constant factor.
x = linspace(350, 600).'; % Assume Column Vectors
spectra = rand(100, 5); % Original Data
offset_multiplier = 1.5;
column_offset = linspace(0, size(spectra,2)*offset_multiplier, size(spectra,2)); % Offset Vector
plot_spectra = spectra + column_offset; % Data With Offset
figure
plot(x, spectra)
grid
title('Plotted Together')
figure
plot(x, plot_spectra)
grid
title('Plotted With Offset')
Experiment with the ‘column_offset’ vector to get the result you want with your data.
.
2 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Line Plots finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!