gnuplot:如何在轴和pm3d地图图之间留出一些空间 [英] Gnuplot: how to have some space between axes and pm3d map plot

查看:132
本文介绍了gnuplot:如何在轴和pm3d地图图之间留出一些空间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我的代码:

f(x,y)=sin(1.3*x)*cos(.9*y)+cos(.8*x)*sin(1.9*y)+cos(y*.2*x)
set size square
set xrange [-5:5]
set yrange [-5:5]
set contour base
set cntrparam level incremental -3, 0.5, 3
set palette rgbformulae 33,13,10
set pm3d map
set isosample 250, 250
unset key
set lmargin at screen 0.05
set rmargin at screen 0.9
set bmargin at screen 0.05
set tmargin at screen 0.9
splot f(x,y) with pm3d

这是数字:

如何在轴和实际图之间留出一些空间,像这样:

How can I have some space between axes and the actual plot like this one:

推荐答案

对于数据集,可以将set offsetsset autoscale fix一起使用来实现此目的.因此,一种选择是将数据绘制到文件(set table 'tmp.txt'; splot f(x,y) w l;未设置表`),然后将该文件绘制为数据.

For data sets one can use set offsets together with set autoscale fix to achieve exactly this. So one option is to plot you data to a file (set table 'tmp.txt'; splot f(x,y) w l; unset table`) and then plot that file as data.

另一种选择是重新定义您的函数,以针对特定范围之外的样本返回1/0.

Another option would be to redefine your function to return 1/0 for samples outside a certain range.

我发现最优雅的方法(至少是我发现的方法)是使用参数模式,并使用比xrangeyrange小的urangevrange:

What I found to be the most elegant way (at least what I found), is to use parametric mode and use smaller urange and vrange than xrange and yrange:

reset
f(x,y)=sin(1.3*x)*cos(.9*y)+cos(.8*x)*sin(1.9*y)+cos(y*.2*x)
set size square

set contour base
set cntrparam level incremental -3, 0.5, 3
set palette rgbformulae 33,13,10
set pm3d map
set isosample 250, 250
unset key
set lmargin at screen 0.05
set rmargin at screen 0.9
set bmargin at screen 0.05
set tmargin at screen 0.9

# 5% margin on each side
m = 1.05
set xrange [-m*5:m*5]
set yrange [-m*5:m*5]
set urange [-5:5]
set vrange [-5:5]
set parametric

splot u,v,f(u,v) with pm3d

带有结果(带有4.6.4):

with the result (with 4.6.4):

这篇关于gnuplot:如何在轴和pm3d地图图之间留出一些空间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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