mappinggnuplotlogistics

Logistic mapping in gnuplot


I have quite big problem when it comes to plotting data. First, I've obtained file data.dat from my c++ program, which implements the logistic map.

Data.dat looks as follows: first column should be the number k which should be on the bottom of the plot. When k is in the range [2,3) everything is fine, there is only one attractor (corresponding value to each k, which is always in the range (0,1)), but when it's [3,4) things get complicated. For each point k there are 2 up to 100 points corresponding to each k. Each of these points is in the separate column, but I have no idea how could I connect those to certain k.

Here is the image of what I'm trying to obain

Here is a sample of my data for points: 2.5, 3, 3.2, 3.5, 3.8 and 3.99999, divided by the newline for clarity (it's not divided by a newline in my original data file)

http://pastebin.com/2AcAjXzk

Thanks for any help, cheers.


Solution

  • Gnuplot cannot handle such a data format properly. Either modify your program such that it prints in each line the k followed by a single value, or you process your data file with a short awk script before plotting:

    plot '< awk ''{ for(i = 1; i <= NF; i++) print $1, $i}'' file.txt' using 1:2 with dots notitle