Weird lines during Gnuplotting - gnuplot

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):

Related

How to move and manage overlapping of x ticks with axis in Gnuplot

I am trying to plot an inlet graph which is shown in Figure. Being an inlet graph it is needed to show x tics and y ticks of relatively big sizes for clear visibility. But when I increase the fonts as,
set xtics font ", 40"
tics overlaps with axis. I increased the plot size set term png size 1000, 1000 but still the issue persists. Kindly suggest if there is a way to move the tics below or to a desired position in graph.
Edit:
The gnuplot script looks like this,
set term png size 1000, 1000
set output "b_vs_N.png"
set style fill solid
set style circle radius 0.001
FIT_LIMIT=1.e-14
set yrange [0.15:0.25]
set style fill solid
set style circle radius 0.001
set xtics 10
set ytics 0.03
set border 15 back lw 6
set xtics font ", 40"
set ytics font ", 22"
set ylabel "b" enhanced font "1 {,40}"
set xlabel "N_i" font "1 {,40}"
set lmargin 12
set bmargin 4
set palette model HSV
set palette rgb 3,2,2
set palette maxcolors 12
set view map
AA(x)=a+b*x+c*x**2
fit AA(x) "data.txt" using 1:2 via c, b, a
plot "data.txt" using 1:2 lt 1 pt 11 ps 2.0 lc rgb "black" notitle, AA(x) w lines lw 2 lc rgb "sienna1" notitle
Your example is uncomplete without code and therefore difficult to reproduce. Please check help xtics. There is the option offset.
Maybe the following example helps to solve your issue.
In the example below no special offset seems to be necessary, i.e. offset 0,0, but you can shift and adjust the labels in x and y direction.
Code:
### tic label offset
reset session
set multiplot
plot sin(x)/x
set origin 0.07, 0.6
set size 0.3,0.3
set xrange [0:10]
set xtics 5 out font ",20" offset 0,0
plot x**2
unset multiplot
### end of code
Result:

rotating the xy plane of a 3D graph in gnuplot

I plotted a 3D graph with gnu plot, with the following commands
set term png
#set term post enh color eps font "Times-Roman, 15"
set output "order.png"
#set title ""
set key outside right bottom vertical reverse enhanced samplen 2 spacing 1.0 width 2 height 1
#set key font "Times-Roman,15"
set xlabel "\eta"
set ylabel "r"
set zlabel "\rho_0"
set xyplane 0
#set view 120,50
set grid
set grid ztics
set xtics 0.5
set ytics 0.5
set ztics 0.05
set tics font "Times-Roman,15"
set tics scale 0.5
set xrange [0:1] noreverse nowriteback
set yrange [0:1] noreverse nowriteback
set zrange [0:0.12] noreverse nowriteback
splot "order0.txt" u 1:2:3
and the plot is :
but I want it to be like the original plot(which is taken from a peper):
I searched the internet, but I just found
set view
which doesn't produce the one that I want.
It sounds as if you would like to rotate the plot around the z-axis so that the r-axis is in "front". The second number in the "set view" command will do that. Try "set view 45 300". Sorry if you meant something else.

Add guiding lines over pm3d map in 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.

Gnuplot scatter with xticlabels and errorbars

I'm trying to do a scatter plot with Y error bars in GNUPLOT, in which the X axis are "names", not numbers.
I'm using this code:
#!/bin/sh
gnuplot -persist <<PLOT
set boxwidth 0.99 relative #ancho relativo de las barras
set border linewidth 1.5
set xlabel "xlabel" font "Verdana,18"
set xlabel offset 0,-1
#set xrange [-5:5]
set xtics font "Verdana,12"
set ylabel "ylabel" font "Verdana,18"
set ylabel offset -2,0
set yrange [-15:15]
set ytics font "Verdana,12"
set key at 4,4 font "Verdana,18"
set style line 1 lc rgb '#0060ad' pt 7 # circle
set xtics rotate by -45 #rota ángulo
plot "file.txt" using 0:2:3:xticlabels(1) with yerrorbars ls 1
quit
PLOT
As a bash script, and then the file.txt is:
Peter 3.06 0.5035
Charles 4.6576 0
Luis -13.1790 0
Where the third column is the Y error bar. However, data appears to initiate exactly in the Origin and not as usual when histogram is used...
Any clues to "shift" or set a range on X with non-numeric values?
Thank you in advance.
If you want to use autoscaling on the x-axis and just add some space to the right and left, then use set offset:
set yrange [-15:15]
set style line 1 lc rgb '#0060ad' pt 7 # circle
set xtics rotate by -45
set offset 0.5,0.5,0,0
plot "file.txt" using 0:2:3:xticlabels(1) with yerrorbars ls 1 notitle

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.

Resources