简体   繁体   中英

gnuplot: how to make lines between points an arc

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

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

在此处输入图片说明

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

在此处输入图片说明

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.

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: 在此处输入图片说明

Now if you change the samples using

set samples 10,100

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

在此处输入图片说明

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

set isosamples 20,20

在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM