1

I have points data in cylindrical coordinates. Can I make them arc like here. Now lines look like those

BPiek
  • 174
  • 11
  • Yes, you can map cylindrical coordinates into Cartesian and plot in any way you want. – Sergei Mar 21 '14 at 16:33
  • But I have set cylindrical and still lines that connects points are straight (i don't have function-as i said i have only points, and while doing splot gnuplot connects those points by lines, but i want them to be as in cylindrical coordinates- arcs) – BPiek Mar 21 '14 at 18:34

2 Answers2

2

To do this with a data file, you can use set dgrid3d and the set table output. The data that you have looks like this:

set pm3d
splot "data" u ($1*cos($2)):($1*sin($2)):3 w l

enter image description here

You can make an interpolation with set dgrid3d to improve the resolution:

set dgrid3d splines 20,20
set table "table"
splot "data" u 1:(acos(cos($2))):3

Now your refined grid data is saved in file "table". Note I sent the angle variable back to the 0 to pi interval to improve the interpolation. It's important to use the splines option, otherwise your data will be interpolated using all the data points, rather than only the neighboring ones. Plot this new data:

set pm3d
splot "table" u ($1*cos($2)):($1*sin($2)):3 w l

enter image description here

More data means the straight lines look less straight because there are more of them. You don't need to use the interpolate option with set pm3d, just adjust the number of scans of the set dgrid3d option.

Miguel
  • 7,497
  • 2
  • 27
  • 46
  • magic :) I forgot to mention to use `set angles degrees; set mapping cylindrical`, but I think there's no difference except type of angle measurement. I really appreciate the help, thank You – BPiek Mar 22 '14 at 21:08
  • Is there a chance to have still the same "range" for each angle? There were no measurement for eg. 80 degrees and r=8m- measurement was imposible to make so for my purpose this shouldn't be shown on plot (Do i have to delete unwonted data from `table` by hand?) – BPiek Mar 23 '14 at 10:11
  • I am not sure I understand the question. In the example I gave, the data is in (r, phi, z) and I plot it in Cartesian coordinates by means of the canonical transformation x = r cos(phi), y = r sin(phi), z = z. So the axes are given with the corresponding Cartesian values. Do you want lines to be drawn only for particular values of phi set at specific values, e.g. every 10 degrees? Is that it? `set dgrid3d` creates a new grid where the upper and lower limits are given by the upper and lower coordinates found in the original data, and then it's divided into the number of subdivisions specified. – Miguel Mar 23 '14 at 14:38
  • No. I ment that i had measurements every 1m, for 0 degree I could measure up to 9m but at bigger angle max radius was smaller (as in data file: (angle, max radius): (0,9),(20,9),(40,7),(60,7) (80,3). I couldn't measure more that's why i have no points. I also dont want them on plot (I dont want to interpolate points in are after max radius). Is there a chance to do this? Deleting "by hand" this thata that is in Cartesian coordinates requires a lot of work – BPiek Mar 23 '14 at 15:23
  • To show this: [plot](http://imageshack.com/a/img23/2711/7kix.png) with areas i want to show and [plot](http://imageshack.com/a/img33/2761/mo50.png) that has unwanted interpolation at big angles and radius – BPiek Mar 23 '14 at 15:40
  • For this I would suggest that you "filter" data using a bash utility, for example `awk`. Use some variant of `cat table | awk '{if( $1 < maxradius && $2 < maxangleforthatradius) print $0}' > table2`. – Miguel Mar 23 '14 at 16:18
  • works like a charm, thx again, I did learn a lot thanks to You. (If some1 would need it i used `cat t | awk '{if( $2 <= 0.69813 || ( $2 <= 1.0472 && $1 <= 7 ) || ( $2 <= 1.3963 && $1 <=3 ) ) print $0 , $1, $2 }' >t2` – BPiek Mar 23 '14 at 17:15
0

I guess you can play with the number of samples used to give the impression that arcs are being drawn. For instance:

set parametric
set samples 10,10
set zrange [0:1]
set urange [0:2*pi]
set vrange [0:2*pi]
splot cos(u)*cos(v),cos(u)*sin(v),cos(u)

Gives the following graph: enter image description here

Now if you change the samples using

set samples 10,100

You get "arcs", which are simply more straight lines:

enter image description here

If you want more surface lines, then play a bit with the set isosamples option:

set isosamples 20,20

enter image description here

Miguel
  • 7,497
  • 2
  • 27
  • 46
  • I suppose it works when u have function, but I have only points in CSV format in cylindrical coordinates (fi, r, z ) – BPiek Mar 22 '14 at 15:44
  • Alright. If your data is well structured you can make an interpolation and generate extra points. Maybe `set dgrid3d` in gnuplot can do this for you, or you can do it externally. I would need to have a look at the data to see how simply it can be done. You can email me the CSV file. – Miguel Mar 22 '14 at 17:16
  • [csv data](http://pastebin.com/19j3SJ3G), z is 3 or 4 column. Sadly i cannot add 3rd link to my question – BPiek Mar 22 '14 at 19:34
  • ofc i forgot to write: 1st column=r; 2nd column=phi ; 3rd/4th=z in cylindrical coordinates. I do not want only to write this circles- I want to use `set pm3d interpolate 50,50` (I managed to do this for basic use of pm3d). – BPiek Mar 22 '14 at 19:51
  • OK, it can be done completely within gnuplot. I'll write another answer in a minute. – Miguel Mar 22 '14 at 20:40