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

댓글 수: 3

Dyuman Joshi
Dyuman Joshi 2024년 1월 23일
이동: Dyuman Joshi 2024년 1월 24일
If you are using R2018b or a later version, utilize stackedplot.
Doyinsola
Doyinsola 2024년 1월 23일
이동: Dyuman Joshi 2024년 1월 24일
Hi Joshi, thank you but stacked plot is like a subplot. That doesn't give me exactly what the plot idea look like the reason I thought there should be another way around it.
Doyinsola
Doyinsola 2024년 1월 23일
이동: Dyuman Joshi 2024년 1월 24일
I have solved it by just adding some offset value to the y-axis for each plot.

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

 채택된 답변

Star Strider
Star Strider 2024년 1월 23일

0 개 추천

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

Doyinsola
Doyinsola 2024년 1월 23일
Thanks Star Strider
Star Strider
Star Strider 2024년 1월 23일
As always, my pleasure!

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

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

태그

질문:

2024년 1월 23일

이동:

2024년 1월 24일

Community Treasure Hunt

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

Start Hunting!

Translated by