Add guiding lines over pm3d map in Gnuplot - gnuplot

I'm trying to add some guiding lines over a pm3d map using Gnuplot.
Below is the code I use to plot pm3d map (my pm3d map).
set terminal post eps enhanced color solid "Helvetica" 16
set encoding iso_8859_1
set hidden3d
set pm3d map
set view map
unset surface
set size square
splot "map.ene" with image
set xlabel "RC1 ({\305})"
set ylabel "RC2 ({\305})"
set cblabel "{/Symbol D}G (kcal/mol)" offset 1,0,0
set xrange ["1":"11"]
set yrange ["5.5":"9.5"]
set cbrange ["-3.1":"0.0"]
set xtics 1
set ytics 1
set cbtics 1
set mxtics 2
set mytics 5
unset key
set palette defined (-3.1 "red", -2.5 "yellow", -1.5 "green", -0.5 "blue", 0 "white")
unset colorbox
set output "map.eps"
replot
map.ene is in the format below:
1.000 5.500 0.00000 i
Now I want to add a vertical line (x=5.5) over the pm3d figure. I searched old posts and found similar questions already been asked by others. Seems there are two possible solutions:
1) prepare a separate data file for the line (x.dat, 5.5,y,0.0) then use command below to plot.
splot "map.ene" with pm3d, "x.dat" using 1:2:(0.0) with points linecolor rgb "black"
2) use "multiplot" facility in Gnuplot.
I tried both, neither worked. I've been playing this for a while but sill not sure how I should modify my original pm3d code to add guiding lines.

you can draw lines in gnuplot:
set arrow from first 5.5, graph 0 to first 5.5, graph 1 nohead
type help coordinates to better tune the above command.

Related

Gnuplot parametric surface plot hidden3d / pm3d border problem

The last couple of hours I've been trying to produce an acceptable-looking plot of a 3D-Object. Now i'm totally stuck at somehow making Gnuplot draw the borders in respect to my 3D-object in a right way. The code I use is this:
reset
set term pngcairo enhanced size 800,600
set output "plot.png"
set grid xtics ytics ls 3 lw 1 lc rgb 'gray'
set xzeroaxis
set yzeroaxis
set samples 30,30
set isosamples 30,30
set style line 100 lt 5 lw 0.5 lc black
set palette gray
set cbrange [-1:1]
unset colorbox
set pm3d depthorder hidden3d implicit
set pm3d lighting primary 0.50 specular 0.6
set parametric
set urange [0:2*pi]
set vrange [0:2*pi]
set xrange [-3.1:3.1]
set yrange [-3.1:3.1]
set zrange [-1.1:1.1]
set xyplane at -1
set view 121,115
set xtics offset first 0,0, -0.1
set ytics offset first 0,0, -0.1
set ytics -2,1,2
set xtics -2,1,2
unset border
set border 4095 front lt black linewidth 2.000 dashtype solid
splot (2+cos(u))*cos(v),(2+cos(u))*sin(v),1*sin(v) lc rgb '#666666'
set output
If you plot that code it results in an image like this:
3D-Object Plot
As you can see the layering of Borders/Axes and Graph is somehow messed up. I spent some time playing around with different terminal types, or set border back / front / behind, or basically all the other options, but i could not succeed in making Gnuplot draw this the right way, which means, the borders surround my Object.
The only compromise solution i could find, is, if i choose certain different view-points Gnuplot gets it all right. But for the one i want the drawing does not work..
I would be very happy about any suggestions or hints!

How to improve lines quality of a heat map

I have plotted the matrix of numbers of this file
pher-of-1365.txt
with this code
set encoding iso_8859_1
set term postscript eps enhanced color size 4.7in,4in
set xlabel "longitude"
set ylabel "latitude"
set output "test0.eps"
set size square
set title "Pheromones" font "Helvetica, 16"
set autoscale fix
set key
set yrange [:] reverse
set view map
splot 'pher-of-1365.txt' matrix with image
Which produces this plot:
The quality is not bad but the lines look blurred.
Is there a way to improve the clarity of the lines in the image?
Regards
Use can try to use a different plot statement, and tweak the point size to get a sharper image. I used your script with the pdf terminal, in 4 different cases:
set terminal pdf size 12,12
set output "test0.pdf"
set encoding iso_8859_1
set xlabel "longitude"
set ylabel "latitude"
set size square
set format cb "%2.0t{/Symbol \327}10^{%L}"
set autoscale fix
unset key
set yrange [:] reverse
set view map
set multiplot layout 2,2
set title "plot with image"
splot 'pher-of-1365.txt' matrix with image
set title "plot with points pointtype 5 pointsize 0.45 palette"
splot 'pher-of-1365.txt' matrix with points pointtype 5 pointsize 0.45 palette
set title "plot with points pointtype 5 pointsize 0.25 palette"
splot 'pher-of-1365.txt' matrix with points pointtype 5 pointsize 0.25 palette
set title "plot with points pointtype 3 pointsize 1.25 palette"
splot 'pher-of-1365.txt' matrix with points pointtype 3 pointsize 1.25 palette
Resulting in:
Things to note:
The only reason the solution on the upper right panel works is because your plotting area is squared, and I used pointtype 5 (filled squares). Then, be tweaking the pointsize param you can fill the entire area. Note what happens on the bottom panels, when I change the size and type on the points.
As mentioned in the comments, the right way of doing this is using image, since it will figure things our by itself, and fill in the plotting area.

Plotting 3D Figures with Gnuplot

I am trying to make a 3D figure with Gnuplot, the following command is used. But the problem is there should be no red color between 0 and 0.5 of y value until y value almost hits 0. Could anyone help me on this please? Thanks!
set terminal postscript color
set output "Figure.ps"
unset key
set xlabel "X"
set ylabel "Y"
set autoscale xfix
set autoscale yfix
set xtics 200 out nomirror
set ytics out nomirror
set pm3d map
set pm3d at b
set pm3d interpolate 0,0
set palette defined (0 "blue", 10 "cyan", 30 "green", 45 "yellow", 70 "orange", 100 "red")
set cbrange [0:0.14]
set ticslevel 0
set dgrid3d 150,300 gauss 0.07
set hidden3d
splot "Total.dat" u 2:1:3 w l
The data file is:
https://drive.google.com/file/d/0B34JSFgK2fIXN0l5UUVYM2hZYVE/view?usp=sharing
With the following command, I got this figure.
set pm3d map
set pm3d at b
set pm3d interpolate 0,1
set pm3d corners2color c1
set palette defined (0 "blue", 10 "cyan", 30 "green", 45 "yellow", 70 "orange", 100 "red")
set cbrange [0:0.14]
set ticslevel 0
splot "Total.dat" u 2:1:3
Now if I plot my data without pm3d command, I can get the following figure. I think the problem is that my data is not distributed evenly (along y-axis), so there are blanks in this figure. And if I use pm3d command, the problem mentioned in the beginning happens. The only way comes out of my mind is that manually "fill" the empty blanks by setting Z-values equal to 0 in my data, but I have no idea how to solve this problem by only changing the command in gnuplot.

Gnuplot color gradients

I need to create a number of vertical gradients in my plot - four in total, in order to clarify direction (N,E,S,W).
#set 0 to 45 degrees color
set obj 1 rectangle behind from screen 0.09,0.2 to screen 0.89,0.29
set palette model RGB defined ( 0 "white", 1 "red")
set cbrange[0:1]
unset colorbox
Am I missing something here?
Thanks in advance
You cannot fill a rectangle with a gradient. The palette affects only plotted functions or data sets. You can either use the image or pm3d plotting style to do this.
One example:
set samples 100
set isosample 100,100
set xrange [0:1]
set yrange [0:1]
set palette defined (0 "white", 1 "red")
set autoscale cbfix
unset colorbox
unset key
set multiplot layout 2,2
plot '++' using 1:2:1 with image
plot '++' using 1:2:2 with image
plot '++' using 1:2:(-$1) with image
plot '++' using 1:2:(-$2) with image
unset multiplot
The output with the pngcairo terminal and version 4.6.5 is:
Now you must find a way to integrate this with the other plots you have.

Weird lines during Gnuplotting

I am trying to plot a 3D figure using Gnuplot, but it gives me some weird lines (valleys) along Y-axis which are not supposed to be there. It seems like my command is not plotting along X-axis properly. And when I change set dgrid3d 300,300 to other values such as 500,500 or 700,700, the number of these weird lines changes as well as their positions. My data file has 2084 points in the X-axis and 125 points in the Y-axis. Hope someone can help me on this.
The following is my command:
set terminal postscript color
set output "Figure.ps"
unset key
set xlabel "X"
set ylabel "Y"
set zlabel "Z"
set xr [0:2084]
set yr [-.99621756724589383480:1.89823137348250416567]
set zr [0:0.025]
set pm3d
set pm3d interpolate 0,0
set palette defined (20 "black", 40 "green", 55 "blue", 70 "orange", 100 "red")
set cbrange [0:0.025]
set ticslevel 0.0001
set dgrid3d 300,300
set hidden3d
set view 45, 345
splot "data" u 2:1:3 w l
and this is the result:
I think the dgrid3d settings together with your clipping of higher z-values gives you this totally distorted representation of the data.
Consider the following, simplified plot of your data:
set terminal postscript eps
set output 'Figure.ps'
set autoscale xfix
set autoscale yfix
set pm3d
set palette defined (20 "black", 40 "green", 55 "blue", 70 "orange", 100 "red")
set zrange [0:0.3]
set cbrange [0:0.1]
set ticslevel 0
set view 64,104
splot 'data' u 2:1:3 with pm3d notitle
This gives the following result (tested with 4.6.5):

Resources