2

Can the following be done in gnuplot? If yes, how?

I have data for time vs position(x,y,z) in a table with t,x,y,z as headers.

I would like to know if I can somehow plot the same time vs position of the particle inside a predefined space with a pause after each time step; so that i can see the evolution of the particles position with time. I would also like to know if I can draw a continuous line from the previous position to the current position so that I can actually see the track of its past.

Example data:

Lets say the predefined space is a box of 10x10x10 and my particle has the following positions over 3 seconds.

t x y z

0 1 2 3 

1 2 3 4

2 3 4 5

3 4 5 6

How do i see the tracking of the particle! my idea is that if i can pause the plot of every time step by a little bit, it will look like an animation which i can just capture using a screen capture software...

UNLESS, this data can be animated using gnuplot too

Is there any other software which does this more efficiently and/or elegantly if gnuplot is not the right tool!?

Any help would be appreciated!

Thanks.

4

2 に答える 2

5

ファイルを作成し、gnuplot シェルmain.gpで実行します。出力は point.gif にあります。ドキュメンテーションhttp://www.gnuplot.info/documentation.htmlまた、gnuplot シェルで 入力することもできます。gnuplot main.gpload "main.gp"

help

main.gp

set term gif animate delay 30 size 400, 400
set output "point.gif"
do for [n=1:4] {
    splot [0:7][0:7][0:7] "data" u 2:3:4 every :::::n w lp t sprintf("n=%i", n)
}

データ

t x y z

0 1 2 3

1 2 3 4

2 3 4 5

3 4 5 6

ここに画像の説明を入力

編集: @mgilson が提案したように、反復に切り替えました。

于 2012-07-24T20:56:34.530 に答える
1

私はそれを理解しました..すべてのコードは5つのコロンの代わりに::::nでなければなりません。さて、2つの別々のファイルを読み、色を変えたい場合はどうすればよいですか?私はこれを持っていて、2つのプロットを赤で着色しています..赤と青が必要な場合はどうなりますか?do for [n = 1:46] {splot [0:0.002] [0:0.0025] [0:0.001] "data3.txt" u 2:3:4 every :::: nw lp t sprintf( "n = %i "、n)splot [0:0.002] [0:0.0025] [0:0.001]" data4.txt "u 2:3:4 every :::: nw lt 1 lw 1 pt 1 ps 1 lc rgb" blue "sprintf(" n =%i "、n)}###2番目のプロットがエラーをスローします。両方のプロットに同じコードが使用されている場合-wrkは発生しません

于 2012-07-25T20:33:05.037 に答える