How do I create a 3d phase-space plot in gnuplot?

前端 未结 1 865
滥情空心
滥情空心 2021-01-03 10:34

See this article Enclosed, but not Encrypted.

I have some binary data. I want to perform the gnuplots shown in that article, but using my data.

1条回答
  •  一整个雨季
    2021-01-03 10:59

    To plot the 3d phase space use the following script, which works like the running average example from the gnuplot page:

    reset
    back4 = back3 = back2 = back1 = 0
    shift(x) = (back4 = back3, back3 = back2, back2 = back1, back1 = x)
    samples(x) = $0 < 3 ? NaN : x
    set ticslevel 0
    # the labels are only for orientation when checking the test data
    set xlabel 'xlabel'
    set ylabel 'ylabel'
    splot 'randomdata.dat' using (shift($1), samples(back4-back3)):(samples(back3-back2)):(samples(back2-back1))
    

    Gnuplot must hold four data values, which are stored in back1 to back4. For every new value, the stored values are shifted with shift. samples takes care that the first three values are not used, but only stored (NaN creates an invalid data point).

    To test it, use this file randomdata.dat:

    21
    15
    10
    6
    3
    1
    0
    

    This plots four data points at (6,5,4), (5,4,3), (4,3,2), and (3,2,1).

    If you have a binary data file with e.g. 16bit numbers, use

    splot 'binaryfile' binary format="%ushort" using (shift($1), samples(back4-back3)):(samples(back3-back2)):(samples(back2-back1))
    

    If you need to change the datasize, invoke gnuplot and type show datafile binary datasizes to see which formats are supported.

    0 讨论(0)
提交回复
热议问题