MATLAB Answers

plotting data of different x values but same number of data points on the same plot

14 views (last 30 days)
Em
Em on 26 Jan 2021
Commented: Em on 27 Jan 2021
I have 2 sets of data that I want to plot on the same axis. One set of data runs from -23 to 23 and the other runs from -20 to 20. I've tried to plot them both on the same axis but I'm just seeing the image below.
This is my code:
plot(airGa(:,1),airGa(:,3),'Color',c(10,:))
xlim([-20 20])
hold on
plot(vacuuminitial550mbarGa(:,1),vacuuminitial550mbarGa(:,3),'Color',c(20,:))
Does anyone have an idea on how I could plot them both together without getting this problem?

Answers (1)

VBBV
VBBV on 27 Jan 2021
%if true
plot(airGa(:,1),airGa(:,3),'Color',c(10,:))
hold on
plot(vacuuminitial550mbarGa(:,1),vacuuminitial550mbarGa(:,3),'Color',c(20,:))
xlim([-23 23])
Try this

Products


Release

R2020a

Community Treasure Hunt

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

Start Hunting!