Getting an error every time i try to convert my Gnuplot into a log scaled plot - gnuplot

I've been trying to translate my plot into a log scaled plot but keep getting these errors:
C:\Users\netha\Technion\Mahmood Jabareen - Nethanel Benzaquen\Thesis\Chapters\Figures\Chapter04\Chapter04_old\Figa>latex
FigPS.tex This is pdfTeX, Version 3.141592653-2.6-1.40.23 (MiKTeX
21.8) entering extended mode (FigPS.tex LaTeX2e <2021-06-01> patch level 1 L3 programming layer <2021-07-12>
(C:\Users\netha\AppData\Local\Programs\MiKTeX\tex/latex/base\article.cls
Document Class: article 2021/02/12 v1.4n Standard LaTeX document class
(C:\Users\netha\AppData\Local\Programs\MiKTeX\tex/latex/base\size10.clo))
(C:\Users\netha\AppData\Local\Programs\MiKTeX\tex/latex/graphics\graphicx.sty
(C:\Users\netha\AppData\Local\Programs\MiKTeX\tex/latex/graphics\keyval.sty)
(C:\Users\netha\AppData\Local\Programs\MiKTeX\tex/latex/graphics\graphics.sty
(C:\Users\netha\AppData\Local\Programs\MiKTeX\tex/latex/graphics\trig.sty)
(C:\Users\netha\AppData\Local\Programs\MiKTeX\tex/latex/graphics-cfg\graphics.c
fg)
(C:\Users\netha\AppData\Local\Programs\MiKTeX\tex/latex/graphics-def\dvips.def)
))
(C:\Users\netha\AppData\Local\Programs\MiKTeX\tex/latex/xcolor\xcolor.sty
(C:\Users\netha\AppData\Local\Programs\MiKTeX\tex/latex/graphics-cfg\color.cfg)
) (labelfig.sty (labelfig.tex))
(C:\Users\netha\AppData\Local\Programs\MiKTeX\tex/latex/base\inputenc.sty)
(C:\Users\netha\AppData\Local\Programs\MiKTeX\tex/latex/l3backend\l3backend-dvi
ps.def) (FigPS.aux) (Pic.tex
(C:\Users\netha\AppData\Local\Programs\MiKTeX\tex/latex/base\cp1252.def)
<Pic.eps> ! Number too big. -2147483648
l.107 \gplfronttext
? ! Dimension too large. \unitlength
l.107 \gplfronttext
? ! Dimension too large. \unitlength
l.107 \gplfronttext
? ) [1] (FigPS.aux) ) Output written on FigPS.dvi (1 page, 852 bytes).
Transcript written on FigPS.log.
C:\Users\netha\Technion\Mahmood Jabareen - Nethanel
Benzaquen\Thesis\Chapters\Figures\Chapter04\Chapter04_old\Figa>dvips
-o FigPS.ps FigPS.dvi This is dvips(k) 2020.1 (MiKTeX21.8) Copyright 2021 Radical Eye Software (www.radicaleye.com) ' TeX output
2022.08.05:1116' -> FigPS.ps <C:/Users/netha/AppData/Local/Programs/MiKTeX/dvips/base/tex.pro>
<C:/Users/netha/AppData/Local/Programs/MiKTeX/dvips/l3backend/l3backend-dvips.pro>
<C:/Users/netha/AppData/Local/Programs/MiKTeX/dvips/base/texps.pro>
<C:/Users/netha/AppData/Local/Programs/MiKTeX/dvips/base/special.pro>
<C:/Users/netha/AppData/Local/Programs/MiKTeX/dvips/base/color.pro>.
<C:/Users/netha/AppData/Local/Programs/MiKTeX/fonts/type1/public/amsfonts/cm/cmr7.pfb>
<C:/Users/netha/AppData/Local/Programs/MiKTeX/fonts/type1/public/amsfonts/cm/cmmi8.pfb>
<C:/Users/netha/AppData/Local/Programs/MiKTeX/fonts/type1/public/amsfonts/cm/cmr8.pfb>
[1<./Pic.eps>]
C:\Users\netha\Technion\Mahmood Jabareen - Nethanel
Benzaquen\Thesis\Chapters\Figures\Chapter04\Chapter04_old\Figa>ps2epsi
FigPS.ps Fig.eps Error: /limitcheck in --arc-- Operand stack:
--nostringval-- 2646 2147483428 2646 2147483428 23.625 0 360 Execution stack: %interp_exit .runexec2 --nostringval--
--nostringval-- --nostringval-- 2 %stopped_push --nostringval-- --nostringval-- --nostringval-- false 1 %stopped_push 2015 1 3 %oparray_pop 2014 1 3
%oparray_pop 1998 1 3 %oparray_pop 1884 1 3
%oparray_pop --nostringval-- %errorexec_pop .runexec2
--nostringval-- --nostringval-- --nostringval-- 2 %stopped_push --nostringval-- --nostringval-- Dictionary stack:
--dict:979/1684(ro)(G)-- --dict:0/20(G)-- --dict:110/200(L)-- --dict:179/300(L)-- --dict:45/200(L)-- --dict:190/256(L)-- Current allocation mode is local Current file position is 86494 Error:
/limitcheck in --arc-- Operand stack: --nostringval-- 2646
2147483428 2646 2147483428 23.625 0 360 Execution stack:
%interp_exit .runexec2 --nostringval-- --nostringval--
--nostringval-- 2 %stopped_push --nostringval-- --nostringval-- --nostringval-- false 1 %stopped_push 2015 1 3 %oparray_pop 2014 1 3 %oparray_pop 1998 1 3
%oparray_pop 1884 1 3 %oparray_pop --nostringval--
%errorexec_pop .runexec2 --nostringval-- --nostringval--
--nostringval-- 2 %stopped_push --nostringval-- --nostringval-- --nostringval-- --nostringval-- false 1 %stopped_push --nostringval-- --nostringval-- Dictionary stack:
--dict:982/1684(ro)(G)-- --dict:0/20(G)-- --dict:87/200(L)-- --dict:50/50(L)-- --dict:179/300(L)-- --dict:45/200(L)-- --dict:190/256(L)-- Current allocation mode is local MiKTeX GPL Ghostscript 9.25: Unrecoverable error, exit code 1
Here is a copy of the code I'm running
set terminal epslatex
set output 'Pic.tex'
set lmargin 1
set rmargin 1
set bmargin 1
set tmargin 1
set size 0.45,0.50
set pointsize 0.75
set xrange [0.10:+550]
set yrange [0.10:1.000]
set log x
set log y
set ytics nolog
set xlabel "DOF"
#set format x "%4.0f"
set xtics border out scale 1,0.5 nomirror
#set mxtics 5
set ylabel "Error [\\%]" offset 1.0,0
#set format y "%3.2f"
set ytics border out scale 1,0.5 nomirror
#set mytics 4
set tics out
set key at 500,-2.750
#set grid
plot "IGAdisx.txt" using 1:2 title "\\scriptsize{IGA}" with linespoints dashtype 1 linewidth 4.000 pointtype 4 linecolor rgb 'blue',\
"FEAdisx.txt" using 1:2 title "\\scriptsize{FEA}" with linespoints dashtype 1 linewidth 4.000 pointtype 6 linecolor rgb 'red'
unset output
With the following data:
FEAdisx
42 -13.10825586
130 -3.571865827
266 -1.027164519
450 -0.409075656
682 -0.165172485
962 -0.042107887
IGAdisx
80 -6.514226074
120 -3.369717311
168 -1.761173369
224 -0.97168048
288 -0.551561334
360 -0.310583989
440 -0.162186678
528 -0.065674441
624 0

This may be the same issue as reported on the gnuplot issue tracker: https://sourceforge.net/p/gnuplot/bugs/2456/
If so, it is due to a weird compiler error specific to Windows 10 and reported only for the gnuplot epslatex terminal. Other terminals and other Windows versions are not affected. Possible work-around: use set term cairolatex eps terminal instead of set term epslatex.
If you are not using epslatex + Windows 10, please add relevant version and OS information to the question.

Related

How to make circle in gnuplot 4.0

Since I have to use an old version of gnuplot 4.0, I found that the circle style is not available. Can any one suggest me how to draw circle with different size from data like this:
x y size
0.000000 -18.595474 2.752
0.154186 -18.574680 0.752
0.308371 -18.513723 0.752
0.462557 -18.416941 3.753
0.616743 -18.291512 1.754
0.770928 -18.147374 2.755
0.925114 -17.996800 2.757
1.079300 -17.853565 0.759
1.233485 -17.731370 4.761
1.387671 -17.642539 0.763
1.541857 -17.605154 1.763
I use a command like this but it told me an error that undefined variable: variable
plot "data0" u 1:2:3 with points pt 7 lt 1 ps variable title 'total'
Thank you so much!
Ouch, I would say this is not straightforward. This feature (using variable pointsize from data) and a lot of other useful features (loops, expressions in plot command, arrays, etc. ) to create an "easy" workaround were introduced in later versions of gnuplot.
In gnuplot 5.2.6, this would simply be
plot 'Data.dat' u 1:2:3 w p ps var
However, for gnuplot 4.0, you can create a strange workaround with
a fixed x-y-range
multiplot
reread a subroutine
fitting data to get the value of the third column into a variable (pretty weird)
if you also want the last data point you have to add
some dummy data line at the end
Tested with gnuplot 4.0 on Win 7 with a windows terminal. Maybe I overlooked a simpler way, but with gnuplot 4.0 you are pretty limited. You must have a good reason that you don't want or cannot update to newer versions.
Data: tbCirclesV4.dat
# x y size
0.000000 -18.595474 2.752
0.154186 -18.574680 0.752
0.308371 -18.513723 0.752
0.462557 -18.416941 3.753
0.616743 -18.291512 1.754
0.770928 -18.147374 2.755
0.925114 -17.996800 2.757
1.079300 -17.853565 0.759
1.233485 -17.731370 4.761
1.387671 -17.642539 0.763
1.541857 -17.605154 1.763
0.000000 0.000000 0.000
Main program: tbCirclesV4.plt
### mimic "plot 1:2:3 w p ps var" in gnuplot V4.0
reset
set term windows
set multiplot
set xrange[-0.1:1.6]
set yrange[-19:-17]
i=0
Max=11
f(x) = a*x + b
load 'tbCirclesV4Loop.plt'
unset multiplot
### end of code
Sub-Routine: tbCirclesV4Loop.plt
### sub-routine
a=1
b=1
fit [*:*][*:*] f(x) 'tbCirclesV4.dat' every ::i::i+1 u 0:3 via a,b
print "Size: ", i, b
# use pointsize b*2 to enlarge the circles a little
plot 'tbCirclesV4.dat' u 1:2 every ::i::i w lp pt 8 ps b*2 lt i+1 notitle
i=i+1
if (i<Max) reread
### end of sub-routine
Result:

Problem with xrange in fill transparent plot

In the following Gnuplot:
set xlabel "Network size, m [r]" font " Helvetica,17"
set ylabel "Algorithms computation time [s]" font "Helvetica,17"
$t500 << EOD
1 0 0 0
2 0.00933135 0.0640543 0.215254
3 0.00954345 0.0746418 0.416871
4 0.009779 0.0853093 0.621712
5 0.0101225 0.0958813 0.822831
6 0.0106212 0.106193 1.02248
7 0.0114236 0.11658 1.22483
8 0.0126996 0.128502 1.42843
9 0.0150443 0.138803 1.62994
10 0.0193814 0.149177 1.83284
11 0.0282591 0.159563 2.0358
12 0.0450926 0.170019 2.24009
13 0.0791815 0.180668 2.44586
14 0.146265 0.191207 2.65134
15 0.284757 0.201806 2.85782
16 0.556054 0.212695 3.0671
17 1.11529 0.223592 3.27625
18 2.22795 0.234535 3.4873
19 4.55297 0.245686 3.69976
20 9.02265 0.257064 3.91294
EOD
set key spacing 1.0
set key top left font "Helvetica, 17"
#set xrange [2:20]
#set yrange [0.001:1000]
set logscale y
set grid
set terminal pdfcairo transparent enhanced
set style function filledcurves y1=0
set ytics ("0" 0.001,"0.01" 0.01,"0.1" 0.1,"1" 1,"10" 10,"100" 100)
unset colorbox
set style fill transparent solid 0.2 border
set bmargin 3.5
set out "program500.pdf"
plot [][] '$t500' using 1:2 title 'S computation' w filledcurves lc rgb "forest-green",\
'$t500' using 1:($2+$3) title 'S computation + Stability computation' w filledcurves lc rgb "violet",\
'$t500' using 1:($2+$4) title 'S computation + Max joint flow computation' w filledcurves lc rgb "gold"
The problem I have is set xrange [2:200] the plot changes and fills the curves upwards, like this,
I would like to know how to keep the filling below the curves as in the first plot with the default ranges and setting xrange [2:20].
"with filledcurves" allows many variants. See the documentation for help filledcurves. The default is with filledcurves closed, which tries to use the points to define a perimeter enclosing a surrounded area. If the curve runs off the edge of the plot, the edges of the plot are used to complete the perimeter. As you found, sometimes the edges chosen by the program are not the ones you wanted.
To control this, use one of the other variants. In this case you probably want with filledcurves y=0, which defines the line at y=0 as part of the perimeter.
... initial lines as above ...
set xrange [2:20]
plot'$t500' using 1:2 title 'S computation' w filledcurves y=0 lc rgb "forest-green",\
'$t500' using 1:($2+$3) title 'S computation + Stability computation' w filledcurves y=0 lc rgb "violet",\
'$t500' using 1:($2+$4) title 'S computation + Max joint flow computation' w filledcurves y=0 lc rgb "gold"

How to make a spider plot in gnuplot?

Let's say my data is in the form:
#atom a b c
43 1.2 1.3 1.4
44 1.2 1.4 1.8
45 1.3 1.8 1.9
46 2.0 2.3 2.4
47 1.5 1.6 1.8
And I want a plot like this one http://www.r-graph-gallery.com/143-spider-chart-with-saveral-individuals/ (the one in the middle).
how can I do that?
ps. The title in here (How to Create a Spider Plot in Gnuplot?) is misleading...
As far as I know, there is no built-in functionality which would directly give you the linked output. Nevertheless, one could improvise with the tools that Gnuplot does provide. The strategy would be to:
analyze the file and determine the number of vertices
generate the "polygonial" grid in parametric mode
plot the data using the filledcurves plotting style (with transparency)
For example (the data is represented as a datablock instead of directly passing a file):
reset session
set terminal pngcairo enhanced font "Times,16"
set output 'plot.png'
$DATA << EOD
#atom a b c
43 1.2 1.3 1.4
44 1.2 1.4 1.8
45 1.3 1.8 1.9
46 2.0 2.3 2.4
47 1.5 1.6 1.8
EOD
stats $DATA nooutput
N = STATS_columns
M = STATS_records
set angles degrees
set size ratio -1
set style fill transparent solid 0.25
unset key
unset border
unset xtics
unset ytics
colors = "dark-red royalblue forest-green"
set style line 42 lt 1 lc rgb '#333333' dt 3 lw 0.8
deltaR = 0.5
maxR = 3 + deltaR/4
numOfStepsInR = floor((1.*maxR) / deltaR)
#helper functions
alpha(i) = 90. - i*360./M
posX(i, r) = cos(alpha(i))*r
posY(i, r) = sin(alpha(i))*r
lcolor(i) = word(colors, i%words(colors) + 1)
do for [i=0:M-1] {
stats $DATA every ::i::i using (labelValue=$1) nooutput
set label sprintf("%d", labelValue) at posX(i,maxR),posY(i,maxR) center offset char posX(i,1),char posY(i,1)
}
do for [j=1:numOfStepsInR] {
set label sprintf("%.1f", j*deltaR) at 0,j*deltaR left offset char 0.5,0 tc rgb '#333333'
}
set parametric
set tr [0:1]
set xr [-1.1*maxR:1.1*maxR]
set yr [-1.1*maxR:1.1*maxR]
plot \
for [i=0:M-1] \
(cos(alpha(i))*(deltaR*(1-t)+t*maxR)),(sin(alpha(i))*(deltaR*(1-t)+t*maxR)) w l ls 42, \
for [i=0:M-1] for [j=1:numOfStepsInR] \
(j*deltaR*cos(alpha(i))*t + (1-t)*j*deltaR*cos(alpha(i+1))),(j*deltaR*sin(alpha(i))*t + (1-t)*j*deltaR*sin(alpha(i+1))) w l ls 42, \
for [i=2:N] $DATA u (posX($0, column(i))):(posY($0, column(i))) w filledcurves closed fc rgb lcolor(i-2) fs border lc rgb lcolor(i-2) lw 2, \
for [i=2:N] $DATA u (posX($0, column(i))):(posY($0, column(i))) w p ps 1.2 pt 7 lc rgb lcolor(i-2)
This produces:

GNUplot: drawing color map from file

I am dealing with a color map but I encounter some problem. Here is my code:
set size 1,1; set origin 0,0
set grid layerdefault
set xlabel "x (rdaius)"
set ylabel "z (radius)"
set sample 11; set isosamples 11
set pm3d map
set palette
set colorbox
set lmargin 0
set pm3d flush begin
splot 'density.txt' u 1:2:3
However, there is error message:
Warning: Single isoline (scan) is not enough for a pm3d plot.
How can fix the problem?
Also, I tried using plot 'density.txt' u 1:2:3 with image, there is also error message:
Number of pixels cannot be factored into integers matching grid. N = 36759 K = 201
Note
The data file density.txt is formatted as
X Y N Part.
===== ===== =====
-10.0 -10.0 10.0
-10.0 -9.9 324.0
-10.0 -9.8 256.5
-10.0 -9.7 0.0
-10.0 -9.6 32.5
-10.0 -9.5 7.8
-10.0 -9.4 66.4
... ... ...
Where x and y ranges from -10 to 10, N. Part ranges from 0.0 to ~1000.0.
Thanks!
You need a blank line after before you increment values in your first dimension:
#data.dat
<x1> <y1> <z11>
<x1> <y2> <z12>
<x1> <y3> <z13>
<x1> <y4> <z14>
<x2> <y1> <z21>
<x2> <y2> <z22>
<x2> <y3> <z23>
<x2> <y4> <z24>
...
<xn> <y1> <zn1>
<xn> <y2> <zn2>
<xn> <y3> <zn3>
<xn> <y4> <zn4>
You'll also need to skip over your headers with splot 'data.dat' every ::2 ...

2 region on graph with power law on gnuplot

I want to know if I can make 2 power law on same data on gnuplot. I have 2 regions on my graphic and want both power law. I know how to make on xmgrace, but I dont like the final art from xmgrace, and I want to make a epslatex of this figure. All time I try to do the power law its start at zero, in both regions, on xmgrace I can make the up power low start at that region, like this
https://www.dropbox.com/s/hdyjm1c36evi1ph/Global.eps?dl=0
EDIT: I post all data here now.
This is my data.
0.000000 0.000180
0.002000 0.000180
0.004000 0.000180
0.006000 0.000360
0.008000 0.000240
0.010000 0.000360
0.012000 0.000420
0.014000 0.000480
0.016000 0.000540
0.018000 0.000720
0.020000 0.000660
0.022000 0.000840
0.024000 0.000960
0.026000 0.001080
0.028000 0.001200
0.030000 0.001320
0.032000 0.001320
0.034000 0.001500
0.036000 0.001560
0.038000 0.001740
0.040000 0.001800
0.042000 0.002040
0.044000 0.002040
0.046000 0.002400
0.048000 0.002460
0.050000 0.002340
0.052000 0.002640
0.054000 0.002700
0.056000 0.002760
0.058000 0.002940
0.060000 0.002760
0.062000 0.002940
0.064000 0.003180
0.066000 0.003000
0.068000 0.003180
0.070000 0.003120
0.072000 0.003120
0.074000 0.003060
0.076000 0.003120
0.078000 0.003180
0.080000 0.003300
0.082000 0.003120
0.084000 0.003180
0.086000 0.003300
0.088000 0.003300
0.090000 0.003300
0.092000 0.003420
0.094000 0.003300
0.096000 0.003480
0.098000 0.003420
0.100000 0.003540
0.102000 0.003360
0.104000 0.003360
0.106000 0.003540
0.108000 0.003480
0.110000 0.003540
0.112000 0.003360
0.114000 0.003540
0.116000 0.003420
0.118000 0.003480
0.120000 0.003420
0.122000 0.003600
0.124000 0.003480
0.126000 0.003480
0.128000 0.003900
0.130000 0.003540
0.132000 0.003900
0.134000 0.003600
0.136000 0.003720
0.138000 0.003780
0.140000 0.003660
0.142000 0.003720
0.144000 0.003780
0.146000 0.003660
0.148000 0.003720
0.150000 0.003900
0.152000 0.003780
0.154000 0.003840
0.156000 0.003960
0.158000 0.003900
0.160000 0.003900
0.162000 0.003840
0.164000 0.003960
0.166000 0.004020
0.168000 0.003960
0.170000 0.004140
0.172000 0.004020
0.174000 0.004020
0.176000 0.004140
0.178000 0.004080
0.180000 0.004020
0.182000 0.004020
0.184000 0.004200
0.186000 0.004200
0.188000 0.004200
0.190000 0.004260
0.192000 0.004320
0.194000 0.004080
0.196000 0.004200
0.198000 0.004140
On gnuplot i separate the data in 2 data. Saw where start each region, and do
set term postscript eps enhanced color
set output "powerlaw.eps"
set ylabel "{/Symbol D}{/Symbol w}"
set xlabel "d"
set logscale x
set logscale y
f(x) = a*x**b
g(x) = c*x**d
h(x) = x < 0.057 ? f(x) : g(x)
fit h(x) 'data.dat' u 1:2 via a,b,c,d
pl "data.dat" w p tittle "", h(x)
them i got for a,b,c,d
a = 0.0898041 +/- 0.3695 (411.4%)
b = 1.20131 +/- 1.299 (108.2%)
c = -0.626148 +/- 2.368e+19 (3.782e+21%)
d = 28.5183 +/- 2.372e+19 (8.316e+19%)
EDIT:10/01/2015
i found a solution but dont know why, I change the code for
set term postscript eps enhanced color
set output "powerlaw.eps"
set ylabel "{/Symbol D}{/Symbol w}"
set xlabel "d"
set logscale x
set logscale y
f(x) = a*x**b+e
g(x) = c*x**d+f
h(x) = x < 0.057 ? f(x) : g(x)
fit h(x) 'data.dat' u 1:2 via a,b,c,d,e,f
pl "data.dat" w p, h(x)
with this i got
a = 0.156195 +/- 0.03023 (19.35%)
b = 1.40894 +/- 0.0678 (4.812%)
c = 0.00781003 +/- 0.00111 (14.21%)
d = 0.803641 +/- 0.1621 (20.17%)
e = 0.000178048 +/- 4.158e-05 (23.35%)
f = 0.00217076 +/- 0.0002812 (12.95%)
see the difference for c and d? And e f is almost zero.
Thanks with help.
I still can't access your data because I'm behind the Great Fire Wall. But as I discern from your script, I can guess what you want.
Now I audaciously post my solution:
Firstly, define a ternary function h(x) = x < num ? f(x) : g(x)
Then fit the data with h(x): fit h(x) 'data.dat' via a,b,c,d
Finally, plot the data and h(x): plot 'data.dat' w p, h(x)

Resources