Top: Table of contents
Up: Table of contents chapter 8
Next: 8.8 3d plotting
Previous: 8.6 Polar coordinates

8.7 Mapping

一般将 2D 数值资料图形绘于平面,我们可使用 mapping 此参数将资料投影 于球面或圆柱面上。图23 中世界地图的地形曲线资料是储存在 world.dat 档案内,各大城市的座标位置资料储存在 world.cor 档案内。所有资料数据局限在 (180,90) 和 (-180,-90) 之间。

第一部份是将地图绘于平面上。第二部份是将地图绘于球面上,是将资料数据经 由一组函数转换后再描绘于 3D 空间上。第三部份是将地图绘于圆柱上。

set title "Gnuplot Correspondences"
set nokey
set noborder
set noyzeroaxis
set noxtics
set noytics
#
# plot world map and correspondent locations as a +
plot 'world.dat' with lines 3 4, 'world.cor' with points 1 2
# 3D version using spherical coordinate system
set angles degrees
set title "3D version using spherical coordinate system"
set view 70,40,,2.0
set mapping spherical
set parametric
set samples 32
set isosamples 9
set urange [-pi/2:pi/2]
set vrange [0:2*pi]
splot cos(u)*cos(v),cos(u)*sin(v),sin(u) with lines 5 6,\
      'world.dat' with lines 3 4, 'world.cor' with points 1 2
# 3d version using cylindrical coordinate system
set title "3d version using cylindrical coordinate system"
set view 70,40,,2.0
set angles degrees
set mapping cylindrical
set parametric
set samples 32
set isosamples 9
set urange [-pi:pi]
set vrange [-90:90]
splot cos(u),sin(u),v with lines 5 6,\
      'world.dat' with lines 3 4, 'world.cor' with points 1 2

图 23: Example : the world map


Top: Table of contents Next: 8.8 3d plotting