2

I have data file in the following format:

1,00000 2,00000 3,00000
1,37864 1,83839 2,90917
1,71932 1,75834 2,77034
2,03327 1,75821 2,58788
2,32958 1,83535 2,36475
2,61380 1,98720 2,10290
2,88682 2,21109 1,80385
3,14388 2,50283 1,46933
3,37385 2,85424 1,10207
3,55891 3,25003 0,70675
3,67565 3,66464 0,29077
3,69810 4,06096 -0,13516
3,60327 4,39280 -0,55697
3,37826 4,61289 -0,95808
3,02656 4,68499 -1,32117
2,57023 4,59570 -1,63053
2,04607 4,35956 -1,87439
1,49686 4,01436 -2,04634
0,96171 3,60912 -2,14556
0,46928 3,19100 -2,17583
...

That is, there is a 3-dimensional point on each line.

I want to plot these points as a curve in 3D space, so these points would be connected one by one starting from the first with straight lines.

However, the following gnuplot program does not work:

set xrange [-5:5]
set yrange [-5:5]
set ticslevel 0
splot "data.dat" u 1:2:3 with lines

It gives very strange results: plot

Looks like that gnuplot for some reason approximates all my data with integral points.

I thought that it may be that my data really gives this picture, however, when I asked gnuplot to plot only dots instead of lines, it still plotted only integral points, joints of the lines on the plot above.

Why is this so? I couldn't force google to give me an answer. Looks like no one interested in plotting curves in 3D space :)

1
  • A helpful question, but the title is misleading. Perhaps something about integral points in the title would fit better. Commented Oct 7, 2012 at 5:35

1 Answer 1

2

You should replace coma with a dot in the data.dat file. Decimal separator is a subject of regional settings in most of operating systems. For example it's coma for region Russia and dot for US and UK.

On Linux regional settings can be checked with locale utility

locale -k LC_NUMERIC
decimal_point="."
thousands_sep=","
grouping=3;3
numeric-decimal-point-wc=46
numeric-thousands-sep-wc=44
numeric-codeset="UTF-8"

One of possibilities for conversion on Unix-like systems is to use sed for modifying file in place

sed -i "s/,/./g" data.dat
Sign up to request clarification or add additional context in comments.

1 Comment

Thank you very much, that worked perfectly! How could I forget about it?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.