Question

I have three sets of data to plot as follows:

set1=[1.2, 4.5, 3.2, 2.4, 6.3, 2.3, 5.4, 5.7, 4.3, 3.3, 1.1]
set2=[1.6, 4.5, 3.2, 2.4, 9.3, 7.3, 5.4, 5.7, 4.1, 3.3, 1.1]
set3=[1.2, 5.5, 3.2, 2.4, 2.3, 2.3, 5.4, 5.7, 7.3, 3.3, 0.1]

I can plot each one of them alone like this

plot(0:0.1:1, set1)

However, now I wish to splice them one next to another, following the order set1, set2, and finally set3. Note that I am NOT looking for subplot. Instead, I am trying to splice them one next to another seamlessly.

How may I do that?

Was it helpful?

Solution

If you can plot each of the segments alone, and are only worried about drawing the line, simply use hold on;

hold on
plot(0:0.1:1, set1)
plot(1:0.1:2, set2) %I took a guess at these x coordinates
plot(2:0.1:3, set3)

You can also combine them as Luis recommended , but in this way you don't need to worry about overlapping areas looking strange or about the order of the sets.

If you want different colors for the lines, use hold all instead.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top