SeasonalShot
SeasonalShot

Reputation: 2589

Plot a line between 2 points in a graph

I am plotting a graph as plot(m,n,'o'). In this graph, graph i again need to plot a line between 2 points.

Already tried:

plot(m,n,'o',[10 10],[100 70])

The second part is just giving me the points .What i need is a straight line that connects the 2 points.

Upvotes: 2

Views: 142

Answers (1)

zinjaai
zinjaai

Reputation: 2385

I think you're looking for:

m = 1:10;
n = rand(1,10);
plot(m,n, '-o')   % plot a normal line and circles at marker points

the '-o' is a combination of:

  • '-' defines a normal line
  • 'o' that defines circles at marker points.

Upvotes: 2

Related Questions