Gnuplot: how to have some space between axes and pm3d chart

Here is my code:

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

This is the figure:

enter image description here

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

enter image description here

+4
source share
1 answer

For datasets, you can use it set offsetstogether set autoscale fixto achieve just that. Thus, one option is to line up the data in a file ( set table 'tmp.txt'; splot f(x,y) w l; unset table`), and then display this file as data.

Another option is to override the return function 1/0for samples outside a certain range.

, ( , , ), - urange vrange, xrange 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):

enter image description here

+3

Source: https://habr.com/ru/post/1538075/


All Articles