Ask Your Question
0

Plot Series of 3D Direction Vectors (Not All from Origen)

asked 2012-07-22 14:52:05 +0200

Justin1 gravatar image

updated 2012-07-22 16:30:45 +0200

calc314 gravatar image

Hi,

I'm trying to plot a series of vectors. I've pasted what I have below. The problem is that I want to plot the second vector, starting from the end of the first vector. If I run the commands below, I get two vectors plotted as I want (with arrows) but they are both from the origin.

I tried looking at MATPLOTLIB to see what to do but I got stuck.

Is there an easy way to plot a series of vectors in the way that I want?

a=vector([1,1,1])
b=vector([2,2,3])
aPlot=plot(a, legend_label='Vector a')
bPlot=plot(b, legend_label='Vector b')
AllPlot=aPlot+bPlot
AllPlot.show()
edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
3

answered 2012-07-24 05:33:14 +0200

Jason Grout gravatar image

You can use the start keyword to give a starting point or vector:

a=vector([1,1,1])
b=vector([-1,2,3])
plot(a)+plot(b, start=a)
edit flag offensive delete link more
2

answered 2012-07-22 15:21:21 +0200

achrzesz gravatar image
sage: a1=arrow((0,0,0), (1,1,1))
sage: a2=arrow((1,1,1), (2,2,3))
sage: a3=arrow((2,2,3), (3,3,1))
sage: a1+a2+a3
edit flag offensive delete link more

Comments

Thanks very much!

Justin1 gravatar imageJustin1 ( 2012-07-22 15:53:12 +0200 )edit

The point being of course that a vector "always" starts at the origin, though some books would disagree.

kcrisman gravatar imagekcrisman ( 2012-07-23 10:55:21 +0200 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2012-07-22 14:52:05 +0200

Seen: 6,105 times

Last updated: Jul 24 '12