How to plat three similar figures together for comparison?
2 views (last 30 days)
Show older comments
I am trying to plot three sets of data together where both A sets go together, both B sets go together and both C sets go together. The way I am doing it I only get the A sets to appear on the figure. What am I doing wrong or need to change so that these data sets all appear on the same figure to compare versus one another?
plot(medianVsA(:,1),medianDepthA(:,1),medianVsB(:,1),medianDepthB(:,1),medianVsC(:,1),medianDepthC(:,1),'b','linewidth',2.5);
hold on
Thank you for the help in advance.
0 Comments
Answers (2)
Star Strider
on 29 Mar 2018
Without your data it is not possible to determine what the problem may be.
However, you are telling plot to use a blue line for all of the data. Use the default color line progression and they will plot in different colours.
Example —
A = [(1:10)' rand(10,1)];
B = [(1:10)' rand(10,1)];
figure
plot(A(:,1), A(:,2), B(:,1),B(:,2), 'b')
title('Blue Lines For All Data')
figure
plot(A(:,1), A(:,2), B(:,1),B(:,2))
title('Default Line Color Progression')
0 Comments
jfrazie9
on 29 Mar 2018
2 Comments
Star Strider
on 29 Mar 2018
The range of your data are extreme. For example, 'medianDepthA' goes from 0.855 to 69, and then jumps at the end to 1E+99. (Also, ‘medianVsA’ in the files you posted is one element longer than 'medianDepthA'.)
When in doubt, plot with markers, since it makes your data easier to see:
figure
plot(medianVsA(1:end-1), medianDepthA, '-p')
Including the extra dimension is redundant, although the plot is correct:
plot(medianVsA(1:end-1,1), medianDepthA(:,1), '-p')
That is the only problem I see.
See Also
Categories
Find more on Annotations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!