Gnuplot,pm3d和曲面 [英] Gnuplot, pm3d and surfaces

查看:102
本文介绍了Gnuplot,pm3d和曲面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对pm3d和gnuplot有疑问.我想用两种不同的pm3d样式绘制两个不同的表面.我怎样才能做到这一点?是否有可能?我尝试使用多图,但是在这种情况下,曲面将重叠并且无法旋转图形.任何帮助将不胜感激,谢谢!

I have a question about pm3d and gnuplot. I want to plot two different surfaces with two different pm3d styles. How can i do that? Is it possible? I tried with multiplot but in that case surfaces will overlap and i cannot rotate the graph. Any help will be appreciated, thank you!

推荐答案

以下是伪数据示例:

reset 
set xrange[0:1]
set yrange[0:1]
set cbrange[0:1]
set palette defined (0 'green', 1 'red', 1 'blue', 2 'white')
set isosamples 100
set samples 100
set pm3d depthorder
set view 60,335
splot '++' using 1:2:2:(0.5*$2) with pm3d title 'red -> green',\
      '++' using 1:2:1:(0.5*(1+$1)) with pm3d title 'blue -> white'

结果:

要使用数据代替"++"生成的这些伪数据,可以使用stats确定数据范围,并相应地将表面颜色缩放到[0:0.5],将另一个缩放到[0.5:1].

To use data instead of these pseudo data generated by '++' you can use stats to determine the data ranges and scale the surface colors accordingly to [0:0.5] for one, and to [0.5:1] for the other.

这个具有不同颜色范围的概念将两个调色板合并为一个,仅适用于数据文件(包括伪数据文件).要绘制两个彼此不同颜色的球体,首先可以生成一个数据文件,该文件随后用于pm3d绘制:

This concept with the different color ranges to incorporate two palettes in one does work only for data files (including pseudo data files). To plot two spheres beneath each other with different colors, one can first produce a data file, which is later used for pm3d plotting:

reset 
# generate the sphere data
set samples 100
set isosamples 100
set parametric
set urange[0:2*pi]
set vrange[0:pi]
set table 'spheres.dat'
r = 0.25
splot r*cos(u)*sin(v),r*sin(u)*sin(v),r*cos(v) with lines
unset table
unset parametric

# plot the generated data set
set xrange[-1:1]
set yrange[-1:1]
set cbrange[-1:3]
set palette defined (0 'black', 1 'green', 1 'black', 2 'red')

set pm3d depthorder
unset colorbox
unset key
set ticslevel 0
set view 19,34
splot 'spheres.dat' using ($1-0.5):2:3:($3/r) with pm3d, \
      '' using ($1+0.5):2:3:($3/r + 2) with pm3d

结果是

这篇关于Gnuplot,pm3d和曲面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆