Is there a way I can hide these overlayed lines in the back of my plot? I tried to use the hidden3d option, but it doesn't work as I expected.
set encoding utf8
set key right top
set xrange[0:1]
set yrange[0:1]
set grid
set ztics 0.01
set palette rgbformulae -5,-12,-30
set xlabel "x" font "Helvetica, 20"
set ylabel "y" font "Helvetica, 20"
set zlabel "z" font "Helvetica, 20"
set terminal postscript eps enhanced color font "Helvetica, 20"
set output "approx_jacobi.eps"
ue(x,y) = sin(pi*x)*sin(pi*y)/(2*pi**2);
#set hidden3d front
set dgrid3d 31, 31 qnorm 2
splot 'results.dat' with pm3d notitle,\
ue(x,y) w l lw 2 t 'Exact'
The result I'm currently getting is
Using set hidden3d front works fine for me. I had to increase the isosamples a bit to avoid intersections of the lines with the surface due to the linear interpolation. Also you don't need to use set dgrid3d since you already have a regular grid.
set pm3d
set hidden3d front
set ticslevel 0
set isosamples 40
set palette rgbformulae -5,-12,-30
ue(x,y) = sin(pi*x)*sin(pi*y)/(2*pi**2)
splot 'results.dat' with pm3d, ue(x,y) w l
The result with 4.6.5 is:
Related
How to make countour in gnuplot?
I want to plot:
5.300000e+04 1.300000e+02 5.436518e+06
5.300000e+04 1.325000e+02 5.126855e+06
5.300000e+04 1.350000e+02 4.803566e+06
5.300000e+04 1.375000e+02 4.457970e+06
5.300000e+04 1.400000e+02 4.103957e+06
5.300000e+04 1.425000e+02 3.734172e+06
5.300000e+04 1.450000e+02 3.352012e+06
.....
.....
I tried
cd 'G:\'
set view map
set dgrid3d
set ytics font "Times New Roman,12"
set xtics font "Times New Roman,12"
unset key
set palette rgbformulae 30,31,32
set decimalsign ','
set format y "%5.1f"
set format x "%5.1f"
splot "mapa.txt" using 1:2:3 with pm3d
with result
enter image description here
How to edit the right side to see the numbers completly and how is the scale called to change the font?
You can adjust the width of the right margin with:
set rmargin at screen XXX
where XXX is a number from 0 to 1. Exactly the same for the top margin (tmargin), bottom margin (bmargin) and left margin (lmargin).
The color scale is called colorbox in gnuplot.
This more or less does what you want:
set view map
set dgrid3d
set ytics font "Times New Roman,12"
set xtics font "Times New Roman,12"
unset key
#Adjust the width of left and right margins so that the numbers fit
set lmargin at screen 0.1
set rmargin at screen 0.85
set palette rgbformulae 30,31,32
set decimalsign ','
set format y "%5.1f"
set format x "%5.1f"
# Change font of color scale
set cbtics font "Times New Roman,12"
splot "mapa.txt" using 1:2:3 with pm3d
When plotting an X,Y,Z data set as color map I need to smoothen the plot a bit. The data are sparse and I need some sort of gaussian blur applied to the result.
Using following code :
reset
#set zrange [2:6]
set contour
unset surface
set cntrparam levels incr 2.0,0.5,8.0
set view map
set xrange [0:2184]
set yrange [0:1472]
set dgrid3d 100,100,4
set table "ap130_base_contour.txt"
splot 'ap130_base.dat' using 11:12:14
unset table
unset contour
set surface
set table "ap130_base_dgrid.txt"
splot 'ap130_base.dat' using 11:12:14
unset table
reset
set pm3d map
unset key
set palette defined (0 '#352a87', 1 '#0363e1',2 '#1485d4', 3 '#06a7c6', 4 '#38b99e', 5 '#92bf73', 6 '#d9ba56', 7 '#fcce2e', 8 '#f9fb0e')
set autoscale fix
set grid
set terminal png size 2184,1472 enhanced font "Helvetica,20"
set output 'ap130_base.png'
splot 'ap130_base_dgrid.txt' w pm3d, 'ap130_base_contour.txt' w l lc rgb "black"
set output
set terminal X11
The plot looks like this;
Is there a way to make this less 'spotty'?
Your input is much appreciated.
Gert.
Following the great info on splot pm3d I want to create two color / contour plots with same color range.
Below code creates two plots. The way the data comes in the first data set has z-data 2.0 to 5.5. The second 1.5 to 5.5. I would like both plots to use and show the same color key scale for both for better comparison. (i.e. 2 to 6)
I tried using zrange but it did not work.
#- BASE ---------------------------------------------
reset
#set zrange [2:6]
set contour
unset surface
set cntrparam levels incr 2.0,0.5,8.0
set view map
set xrange [0:2184]
set yrange [0:1472]
set dgrid3d 100,100,4
set table "ap130_base_contour.txt"
splot 'ap130_base.dat' using 11:12:14
unset table
unset contour
set surface
set table "ap130_base_dgrid.txt"
splot 'ap130_base.dat' using 11:12:14
unset table
reset
set pm3d map
unset key
set palette defined (0 '#352a87', 1 '#0363e1',2 '#1485d4', 3 '#06a7c6', 4 '#38b99e', 5 '#92bf73', 6 '#d9ba56', 7 '#fcce2e', 8 '#f9fb0e')
set autoscale fix
set grid
set terminal png size 2184,1472 enhanced font "Helvetica,20"
set output 'ap130_base.png'
splot 'ap130_base_dgrid.txt' w pm3d, 'ap130_base_contour.txt' w l lc rgb "black"
set output
set terminal X11
#- TSFF ---------------------------------------------
reset
#set zrange [2:6]
set contour
unset surface
set cntrparam levels incr 2.0,0.5,8.0
set view map
set xrange [0:2184]
set yrange [0:1472]
set dgrid3d 100,100,4
set table "ap130_tsff_contour.txt"
splot 'ap130_tsff.dat' using 11:12:14
unset table
unset contour
set surface
set table "ap130_tsff_dgrid.txt"
splot 'ap130_tsff.dat' using 11:12:14
unset table
reset
set pm3d map
unset key
set palette defined (0 '#352a87', 1 '#0363e1',2 '#1485d4', 3 '#06a7c6', 4 '#38b99e', 5 '#92bf73', 6 '#d9ba56', 7 '#fcce2e', 8 '#f9fb0e')
set autoscale fix
set grid
set terminal png size 2184,1472 enhanced font "Helvetica,20"
set output 'ap130_tsff.png'
splot 'ap130_tsff_dgrid.txt' w pm3d, 'ap130_tsff_contour.txt' w l lc rgb "black"
set output
set terminal X11
Note the color scale i the first plot from 2.0 to 5.5
In the second plot from 1.5 to 5.5
I would like both plots to have a color scale from i.e. 1 to 6.
Your input is appreciated.
Gert
Try
set zrange[2:6]
set cbrange[2:6]
It should do the trick.
I'd like to show the values of a function of 2 variables, say x+y, as a "bitmap" image. So I tried this, based on http://gnuplot.sourceforge.net/demo/heatmaps.html:
# Color runs from white to green
set palette rgbformula -7,2,-7
set cbrange [-5:5]
set cblabel "Value"
unset cbtics
set xrange [-4.5:4.5]
set yrange [-4.5:4.5]
set view map
splot x+y with image
... but I get nothing:
$ gnuplot -persist test.gp
"test.gp", line 45: warning: Image grid must be at least 2 x 2.
So how can I get the "pixel" at, say, x=-2, y=-2 to be colored according to x+y=-4 on the cbrange?
Edit: got that:
set palette rgbformula -7,2,-7
set cbrange [-5:5]
set cblabel "Value"
unset cbtics
set xrange [-4.5:4.5]
set yrange [-4.5:4.5]
set pm3d
unset surface
set view map
splot x+y
Outputs:
But - say I want the gradient in this range, exported as "smooth" gradient (no axes, ticks, marks of any kind) on a big PNG, say 3000x2000 pixels; what would be the best way to achieve that?
Starting from your edit: You just to deactivate every thing. Meaning:
unset colorbox
unset xtics
unset ytics
set border 0
Then id you create the command list:
set palette rgbformula -7,2,-7
set cbrange [-5:5]
unset cblabel
unset cbtics
set xrange [-4.5:4.5]
set yrange [-4.5:4.5]
set pm3d
unset surface
set view map
unset colorbox
unset xtics
unset ytics
set border 0
splot x+y
You get only the gradient
EDIT: In order to improve the gradient step and create a smoother image you need to use pm3d's interpolate.
set pm3d interpolate 4,4
I want the below desired effect
I am using a gnuplot script similar to this
reset
set term postscript eps enhanced "Helvetica" 30
set size square
set xlabel "X position"
set ylabel "Y position"
set pm3d map
set palette rgbformulae 22,13,-31
set xrange [0 : 22.0000000000]
set yrange [0 : 17.0000000000]
set zrange [0 : 0.1614027105]
set xtics 5
set ytics 0,4
set cbtics 0,0.020
set style line 1 lw 1
unset key
set dgrid3d 45,45
set style line 1 lt 1
set hidden3d
splot "data.data" u 1:2:3
set label "98.8" at 9,-2 textcolor lt 1
set label "1.2" at 9,6 textcolor lt 1
But when I do, the labels (98.8, and 1.2) don't get printed. If I provide a bogus data.data file, lets say with only a single (x,y,z) point, then nothing gets graphed and I can see the labels. Therefore, I am guessing that my graph is occluding my labels. How do I get the labels to be printed on top of my graph?
The default placement for labels is in back.
But you can specify that the label show up in front, e.g.:
set label "label in front" at 2.5,0.5 tc rgb "white" font ",30" front
Credit: the (very slightly modified) code for this was found at http://gnuplot.sourceforge.net/demo_svg_4.5/pm3dcolors.html and/or link(s) therefrom.
Also for further information on the placement of text in gnuplot, I found this reference to be very useful.