emphasized textPlotting script that used to work for the previous version of gnuplot
(v4.2.6) no longer work for the latest version (v4.4.0) and produces
error messages for the following script line.
plot "data_file" u ($1+0.5):2 title "legend1" w boxes fs solid 0.85,
"" u ($1+0.5):2:3 notitle w yerrorbars 1,
....
The error goes away as I change "yerrorbars 1" to "yerrorbars".
However, this prohibits the customization of the errorbar style.
Can anyone tell me how can I do this right?
I'm attaching test code that causes the error and the error message.
#!/opt/local/bin/gnuplot
set term postscript monochrome enhanced
set output "test.eps"
set grid x y
set xtics nomirror
set ytics 1.5 font "Helvetica, 18"
set yrange [0:10]
set xrange [0:10]
set boxwidth 1
set bmargin 3
set key top left
plot "test.dat" u ($1+0.5):2 title "test0" \
w boxes fs solid 0.85, \
"" u ($1+0.5):2:3 notitle w yerrorbars 1, \
"" u ($1+1.5):4 title "test1" w boxes fs solid 0.7, \
"" u ($1+1.5):4:5 notitle w yerrorbars 1
I ran above script with the following data.
$ cat test.dat
1 1.315119617 0.131 1.199138756 0.136
7 5.382161114 0.002 4.818144427 0.003
and it generated the following error messages.
$ gnuplot test.plt
plot "test.dat"
....
^ "test.plt", line 17: ';' expected
As I mentioned from above, the error goes away when I change yerrorbar 1 to yerrorbar but this prevent me from specifying error bar style.
Is this what set bars 1 does?
The style of error bars depends on the linestyle which is being used for the plot. So you should specify it like this:
plot "mydata.csv" linestyle 1 with yerrorbars
linestyle 1 is what you need
nblumoe is about the specific style. You can also affect other characteristics, for instance
plot "mydata.csv" linestyle 1 linewidth 2 with yerrorbars
Related
I need to make a 2d plot and a 3d plot, which I want to save as .tex files, respectively labo2-mag/latex/position-x-y-over-time.tex and labo2-mag/latex/position-3d.tex. Is there anything wrong with my script ?
# General settings
set tics font ", 14"
set tmargin at screen 0.7
set key at screen 0.3, 0.8 font ",14" spacing 1.3 samplen 0.8 box opaque
# set key outside font ",14" spacing 1.3 box opaque
# Send the border to the background
set border lw 0.1 back
set xlabel '$t$ [s?]' offset 1.7;
set ylabel '$Position$ [m?]' offset -1;
# Plot once 'in the air'
# set terminal unknown
plot "labo2-mag/data/output.out" using 1:2 with points pointtype 6 lc rgb "red" title '$x(t)$', \
"" using 1:3 with points pointtype 8 lc rgb "green" title '$y(t)$', \
"" using 1:4 with points pointtype 6 lc rgb "blue" title '$z(t)$'
# pause 70
# reread
set terminal cairolatex pdf size 10cm, 10cm
set out 'labo2-mag/latex/position-x-y-over-time.tex'
MAX_Y=GPVAL_Y_MAX
MIN_Y=GPVAL_Y_MIN
MAX_X=GPVAL_X_MAX
MIN_X=GPVAL_X_MIN
set xrange [MIN_X-(MAX_X-MIN_X)*0.1:MAX_X+(MAX_X-MIN_X)*0.01]
set yrange [MIN_Y-(MAX_Y-MIN_Y)*0.05:MAX_Y+(MAX_Y-MIN_Y)*0.05]
replot
# reset terminal
splot "labo2-mag/data/output.out" using 2:3:4 with points pointtype 6 lc rgb "red" title '$pos(t)$'
set terminal cairolatex pdf size 10cm, 10cm
set out 'labo2-mag/latex/position-3d.tex'
replot
Your splot command is issued while the first terminal is still active and writing to the first output file. You need to change the terminal and output before doing a new plot. The minimum would be to issue unset output after each of your replot statements.
You might want or need to also set a new intermediate terminal type together with the unset output. I don't understand the "in the air" comment in the script. Do you mean you don't actually want to plot it? You want to view it interactively before plotting to a file? Otherwise maybe set terminal dumb? If it is relevant, please clarify.
my gnuplot script plot bar graphs in the following 2D format:
using the following sctipt:
set term pngcairo size 800,600
set termoption noenhanced
set title "$file_name" font "Century,22" textcolor "#b8860b"
set tics font "Helvetica,10"
#set xtics noenhanced
set ylabel "Fraction, %"
set xlabel "H-bond donor/aceptor, residue"
set yrange [0:1]
set ytics 0.1
set grid y
set key off
set boxwidth 0.9
set style fill solid 0.5
plot '<cat' using 2:xtic(1) with boxes
In order to add values above the bars, I've tried to modify it to
plot '<cat' using 0:2:xtic(1) with boxes, '' u 0:2:2 w labels offset 0,1
but the values were not added to the bars, with the following warning
"/dev/fd/63" line 17: warning: Skipping data file with no valid points
I can only test for Windows, but I assume cat under Linux is the equivalent for type under Windows.
So, what is your filename? I would say your filename is simply missing. Check help piped-data.
Something like the following should work:
plot '<cat myDataFile.dat' using 0:2:xtic(1) with boxes, '' u 0:2:2 w labels offset 0,1
But then, what is the difference to using directly the filename?
plot 'myDataFile.dat' using 0:2:xtic(1) with boxes, '' u 0:2:2 w labels offset 0,1
I use this script Gnuplot :
set title "df -m command test"
set terminal png truecolor size 720,480 background rgb "#eff1f0"
set output "/xxx/xxx/xxx/test.png"
set grid
set style line 1 \
linecolor rgb '#0060ad' \
linetype 1 linewidth 2 \
pointtype 7 pointsize 1.5
set offsets 0.5,0.5,0,0.5
set datafile separator ","
set ylabel " MB BLOCK "
set xlabel " Date "
set format y "%g"
plot "/xxxx/xxx/xxx/TEST.txt" using 2:xtic(1) with linespoints linestyle 1 title "MB used"
With these data :
2019-08-28,384.00
2019-08-29,394.00
2019-08-30,354.00
2019-08-31,384.00
2019-09-01,484.00
2019-09-02,324.00
2019-09-03,384.00
To create this graph :
(source: noelshack.com)
Can you show me how I can put the value over each point ?
What about this? Also check help labels.
Code:
### plot with values as labels at datapoints
reset session
$Data <<EOD
2019-08-28,384.00
2019-08-29,394.00
2019-08-30,354.00
2019-08-31,384.00
2019-09-01,484.00
2019-09-02,324.00
2019-09-03,384.00
EOD
set datafile separator ","
set offsets 0.5,0.5,20,20
myLabel(n) = sprintf("%g",n)
plot $Data u 2:xtic(1) w lp pt 7 lc rgb "blue" title "MB used", \
$Data u 0:2:(myLabel($2)) w labels offset 0,1.5 notitle
### end of code
Result:
How can I make a plot with some values of delta_x and delta_y positions; where I need to use palette (or colorbars) for each point showing their respective epochs (My current plot, and an example of the plot that I would like to make are shown below).
My current Gnuplot code is as follows:
set fontpath '/System/Library/Fonts'
set term post color enh eps font "Helvetica" 14
#Gnuplot script file for plotting data
#Set Line style
set style line 12 lw 1 ps 1 pt 8 # empty triangle
set style line 13 lw 1 ps 0.7 pt 81 #empty circle
#Add Legend
set key top right box
# set plot
set xrange[1.2:0]
set xlabel "Relative R.A. (mas)" # set xlabel
set mxtics 4
set xtics 0, 0.1, 1.2
set yrange[0:1]
set ylabel "Relative decl. (mas)"
set mytics 4
set ytics 0, 0.1, 1
plot "MOD1.dat" using 1:2 w points ls 13 lc rgb 'black' title "Data1", "MOD2.dat" using 1:2 w points ls 12 lc rgb 'gray' title "Data2"
Where my data are as follows:
Data1:
#Year RA(mas) DEC(mas)
1993-06-26 0.36315 0.23913
1993-12-16 0.33392 0.28443
1994-01-28 0.34606 0.30810
1994-12-23 0.37139 0.32989
1995-02-12 0.34050 0.29165
1995-08-17 0.55405 0.42913
1995-12-18 0.36928 0.2777
1996-04-07 0.49601 0.31533
1996-12-13 0.43557 0.34637
1997-11-14 0.36811 0.25562
1998-06-02 0.55603 0.36268
1998-12-07 0.52873 0.23110
2000-11-12 0.45839 0.22572
ieData2:
#Year RA(mas) DEC(mas)
1993-06-26 0.63633 0.44645
1993-09-18 0.63548 0.35586
1993-12-16 0.63161 0.41704
1994-01-28 0.27266 0.47256
1994-03-14 0.75819 0.65255
1994-04-21 0.69664 0.68481
1994-06-21 0.78735 0.72865
1994-08-29 0.91143 0.78274
1994-10-30 0.55326 0.43258
1994-12-23 0.67065 0.54423
1995-02-12 0.55778 0.51656
1995-08-17 1.01458 0.50502
Thank you.
try the palette linetype, like this:
plot 'MOD1.dat' u 2:3:1 w p pt 7 ps 2 lt palette
I have a file VERTICAL.txt with the following structure :
201
269
614
669
705
with a script traffic.gp :
set terminal jpeg size 1024,768
set title "traffic path 0"
set xlabel "Simulation duration"
set ylabel "Link load (%)"
set grid
set xtics 0,50,1100
set ytics 0.0,10.0,100.0
set key below center
plot [0:1100] [0.0:100.0] 'traffic_path0.txt' with lines title "path 0"
i want to use VERTICAL.txt in traffic.gp to see the corresponding line.
I tried to add:
set parametrics
set trange [0:100]
plot VERTICAL.txt , t
but the following error occurs :"scripts/traffic.gp", line 11: parametric function not fully specified
How can i managed to do that ?
Thanks a lot
This is a somewhat dirty trick that only works if you're not autoscaling the y axis:
YMIN=0
YMAX=100.0
set yrange [YMIN:YMAX]
plot 'test.dat' u 1:2 w lines, \
'VERTICAL.txt' u 1:(YMAX) w impulses ls 2, \
'VERTICAL.txt' u 1:(YMIN) w impulses ls 2
(the YMIN part is actually unnecessary if YMIN is 0).
Another dirty hack you can play is with arrows and system commands:
set for [a in system("tr '\n' ' '<VERTICAL.txt")] arrow from first a,graph 0 to first a,graph 1 nohead