2

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.

Christoph
  • 47,569
  • 8
  • 87
  • 187
xxxxx
  • 159
  • 9

1 Answers1

1

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
Christoph
  • 47,569
  • 8
  • 87
  • 187
  • Working as expected, thanks for your help, appreciated. – xxxxx Jan 18 '16 at 21:04
  • It seems that gnuplot *can* handle this data format: `plot for [i=2:100] 'file.txt' u 1:i with dots lc rgb 'red' notitle`. Gnuplot simply ignores if some lines have less than 100 columns. I don't know if it's efficient at all, but, at least, it does the job :) – vagoberto Jan 20 '16 at 15:40