How to make "filledcurves" change color when two or more meet? (GNUPlot) - colors

I have created a graph that uses lines for the average of my data and filledcurves for the error (average-error, average+error). My problem is that the last filledcurves that is plotted, covers all other fills, even though I have set its transparency. I want to change this so that when two or more filledcurves meet the color is changed and thus the errors are clearly shown for all lines.
My script is:
set datafile separator whitespace
set style line 1 lc rgb '#aa5500' lt 1 lw 2 pt 7 ps 1
set style line 2 lc rgb '#55aaff' lt 1 lw 2 pt 7 ps 1
set style line 3 lc rgb '#aa557f' lt 1 lw 2 pt 7 ps 1
set style line 4 lc rgb '#55007f' lt 1 lw 2 pt 7 ps 1
set style line 5 lc rgb '#005500' lt 1 lw 2 pt 7 ps 1
set style line 6 lc rgb '#0055ff' lt 1 lw 2 pt 7 ps 1
set tics nomirror
set tics front
set style line 12 lc rgb '#808080' lt 0 lw 1
set grid front ls 12
set output 'network_utilization_servers_3_2.png'
set terminal png size 1000,800
set style fill transparent solid 0.25
set style fill noborder
set xrange[0:77]
set yrange[0:1500]
set xlabel "Time (seconds)" font ",12"
set ylabel "Incoming Traffic (KB/s)" font ",12"
set title "Network Utilization in the Servers" font "Helvetica,16"
set key box title "Server" width 10
plot for [i=0:|Group|-1] $Data3 u ($2-6):($3-$4):($3+$4) index i with filledcurves ls i+1 notitle, \
for [i=0:|Group|-1] $Data3 u ($2-6):3:4 index i w lines ti sprintf("%g",Group[i+1]) ls i+1
and my pragh:
My goal is something like this:
Is there a way to achieve this?

Related

GNUPLOT: First data row not shown in barchar [duplicate]

Am using gnuplot 5.0. with the following as pereamble to each script:
set terminal epslatex 8 color standalone colortext
The issue is that gnuplot is skipping the first row. To my knowledge 4.6 version addressed a similar issue.
Any idea on the problem please?
Example of data file points.dat
4 4
4 -4
-4 4
-4 -4
The first line (4, 4) is skipped. So instead of four points, only three are displayed by gnuplot. Herewith the command am using
#!/bin/bash
set terminal epslatex 8 color standalone colortext
set output outputFileName
set size .55,.55
set pointsize 3.0
##############
# Line styles
##############
set linestyle 1 lt 5 lw 1 #
set linestyle 2 lt 2 lw 1.5
set linestyle 3 lt 6 lw 1 #
set linestyle 4 lt 3 lw 1
set linestyle 5 lt 2 lw 2 #
set linestyle 6 lt 1 lw 2
##################
# Titles
##################
set title 'Image'
set xlabel '$x$' offset 0,0.5
set ylabel '$y$' offset 2,0
set macros
filename_init = sprintf("%s/image_init.dat",dataFileDirectory)
set key autotitle columnhead
set key horiz
set multiplot
plot
filename_init u 1:2 with points lt 0 pt 1 lw 5 lc rgb "magenta" notitle 'initial'
On trick to bypass the issue is to duplicate the first row. Bu this is not practical.
With set key autotitle columnheader gnuplot uses the entries in the first row as key entries, even though for the plot you have specified notitle.
To demonstrate this, consider the following script, using the four data points in points.dat, which you posted:
set terminal pngcairo
set output 'foobar.png'
set offsets 1,1,1,1
set key autotitle columnhead
filename_init = 'points.dat'
set multiplot layout 1,2
plot filename_init u 1:2 with points lt 0 pt 1 lw 5 lc rgb "magenta"
set key noautotitle
plot filename_init u 1:2 with points lt 0 pt 1 lw 5 lc rgb "magenta" title 'initial'
unset multiplot
The result is
So, just remove the line set key autotitle columnhead from your script, and use plot ... title 'initial'. That gives you the expected result.

Gnuplot set background color of data label

I want to set the background of data labels to white! The considered plot is a data plot of the following data (gnuDC.dat):
4 1570.96 1571
8 770.63 771
12 530.33 530
16 385.13 385
24 261.87 262
48 137.71 138
96 81.42 81
The plot command reads:
plot "gnuDC.dat" using 1:2 title "DC: GNU Fortran 4.7.2 + Open MPI 1.6.3" w p ls 1, \
"gnuDC.dat" using 1:2:3 with labels center offset 2.,0.7 font "Helvetica,14" tc ls 4 notitle, \
"gnuDC.dat" using 1:3 notitle smooth csplines ls 14
Which gives me:
It looks ok but think one could read the lables better when the would have an white background. Is there an easy way to add the white background for all labels at once?
Here is the whole print file:
set terminal postscript eps size 14cm,10cm enhanced color \
font 'Helvetica,18' linewidth 2
set output 'test.eps'
# Line style for axes
set style line 80 lt 0
set style line 80 lt rgb "#808080"
# Line style for grid
set style line 81 lt 3 # dashed
set style line 81 lt rgb "#808080" lw 0.5 # grey
set grid back linestyle 81
set border 3 back linestyle 80
set xtics nomirror
set ytics nomirror
set style line 100 lc rgb '#0060ad' lt 1 lw 2 pt 7 ps 1.5
set style line 200 lc rgb '#a2142f' lt 1 lw 2 pt 7 ps 1.5
set pointintervalbox 0
set style line 1 lc rgb '#0072bd' lt 1 lw 1 pt 9 pi -10 ps 2
set style line 2 lc rgb '#77ac30' lt 1 lw 1 pt 7 pi -10 ps 2
set style line 3 lc rgb '#d95319' lt 1 lw 1 pt 1 pi -10 ps 2
set bmargin 4
set lmargin 5
set rmargin 4
unset title
set size 1,1
#set origin 0,0.27
set xlabel "number of cores, -"
set ylabel "Computational time, s"
set key top right
set key spacing 1.5
set key width -12
set yrange [0:1710]
plot "gnuDC.dat" using 1:2 title "DC: GNU Fortran 4.7.2 + Open MPI 1.6.3" w p ls 1, \
"gnuDC.dat" using 1:2:3 with labels center offset 2.,0.7 font "Helvetica,14" tc ls 4 notitle, \
"gnuDC.dat" using 1:3 notitle smooth csplines ls 14
With gnuplot version 5 there is a boxed option which does exactly this: give labels a background and, if you want, also a border. The style is controlled with set style textbox, e.g.
set style textbox opaque noborder
plot ... with labels boxed ...
Applied to your script (with some minor changes due to the changed dash handling since 5.0):
# Line style for axes
set style line 80 lt rgb "#808080"
# Line style for grid
set style line 81 dt 3 # dashed
set style line 81 lt rgb "#808080" lw 0.5 # grey
set grid back linestyle 81
set border 3 back linestyle 80
set tics nomirror
set linetype 1 lc rgb '#0072bd' pt 9 pi -10 ps 2 dt 3
set bmargin 4
set lmargin 5
set rmargin 4
set xlabel "number of cores, -"
set ylabel "Computational time, s"
set key top right
set key spacing 1.5
set key width -12
set yrange [0:1710]
set style textbox opaque noborder
plot "gnuDC.dat" using 1:2 title "DC: GNU Fortran 4.7.2 + Open MPI 1.6.3" w p lt 1, \
"gnuDC.dat" using 1:2:3 with labels boxed center offset 2.,0.7 font "Helvetica,10" tc ls 1 notitle, \
"gnuDC.dat" using 1:3 notitle smooth csplines lt 1
No, for versions 4.6 and earlier there isn't an easy way to achieve this.

How to draw a circle on a gnuplot figure?

Basically I have a figure below, which is drawn by gnu plot.
The code is listed as follows:
set term pdf size 2.8,1.4 font "Arial,08"
set output "plot/application.pdf"
set datafile separator ","
set offset 0, 0, 0, 0
set size ratio 0.5
set xtics norangelimit
set ytics nomirror
set termoption dashed
set ylabel "Binary Similarity (%)"
set xlabel "Iteration"
set yrange [0:110]
set style data linespoints
set key vertical maxrows 5
set key top right
set key vertical maxrows 5
set style line 2 lt 1 lc rgb "skyblue" lw 1
set style arrow 8 heads size screen 0.008,90 ls 2 lw 10
set arrow from 9.0,0 to 9.0,40 nohead lw 1 as 8
plot 'plot/application.csv' using 1:xtic((int($0)%4)==0?sprintf("%d", $0*10):"") title columnheader(1) pt 1 lw 1, \
'' using 2 title columnheader(2) pt 2 lw 1 ps .1 lc rgb "#4169E1", \
'' using 3 title columnheader(3) pt 3 lw 1 ps .1 lc rgb "#DAA520", \
'' using 4 title columnheader(4) pt 4 lw 1 ps .1 lc 5, \
'' using 5 title columnheader(5) pt 4 lw 1 ps .1 lc 9, \
'' using 6 title columnheader(6) pt 4 lw 1 ps .1 lc 7, \
'' using 7 title columnheader(7) pt 5 lw 1 ps .1 lc 8, \
'' using 7 title columnheader(8) pt 5 lw 1 ps .1 lc 9
I basically want to highlight datas at 90, and that's why I draw a blue arrow line there.. But as you can see, it looks awkward...
So I am thinking to change the blue line into a red circle, something like this:
Does anyone know how to do that? Note that it even has an associated legend of the red circle.. Thank you!
You can always add
'< echo 90 20 10' w circ
to the plot.

I don't have color on my .eps figure using gnuplot

I want to trace some curves with gnuplot. I recently change my computer and now I have a MacOSX 10.9.5
In my other computer, colors appeared in my .eps figure, but with my Mac not anymore, and an error message appears : "ยท Times not found, using Courier." which is an other problem I think.
My gnuplot version is Version 5.0 patchlevel 0.
Here is my trace.p that I load with gnuplot with
$ gnuplot
gnuplot > load "trace.p"
set autoscale
unset logscale
unset label
set term postscript enhanced 'Times'
set output"E_Hxc_bath_exact_weak.eps"
set title "E^{bath,exact}_{Hxc}/U, E^{bath,weak}_{Hxc}/U functions of U/t with potential more or equal to second-order set to 0"
set xlabel "U/t"
set ylabel "E^{bath}_{Hxc}/U"
set xrange [0.7:10]
set yrange [-7:10]
set key left top
set style line 1 lt 1 lc rgb "red" lw 3
set style line 2 lt 2 lc rgb "red" lw 3
set style line 3 lt 3 lc rgb "red" lw 3
set style line 4 lt 1 lc rgb "green" lw 3
set style line 5 lt 2 lc rgb "green" lw 3
set style line 6 lt 3 lc rgb "green" lw 3
set style line 7 lt 1 lc rgb "black" lw 3
set style line 8 lt 2 lc rgb "black" lw 3
set style line 9 lt 1 lc rgb "blue" lw 3
set style line 10 lt 2 lc rgb "blue" lw 3
set style line 11 lt 3 lc rgb "blue" lw 3
set style line 12 lt 1 lc rgb "violet" lw 3
set style line 13 lt 2 lc rgb "violet" lw 3
plot (0.25 - (3/4)/(sqrt(1+64/(x**2)) + 2*sqrt(1+16/(x**2)))) with lines ls 7 title "exact", (0.25 - 3*(x**2)/64 + (x**3)/(2*16*16)) with lines ls 1 title "weak";
Some lines are certainly useless, but I don't know why the result is colorless, maybe I miss an application or something...
Try adding the color flag to the set term line in your script.
For the dashed lines which didn't appear, it is because in version 5.0, the command change, it is no more linetype but dashtype.
See the response of Gnuplot line types for more precision.

gnuplot: first row of data skipped

Am using gnuplot 5.0. with the following as pereamble to each script:
set terminal epslatex 8 color standalone colortext
The issue is that gnuplot is skipping the first row. To my knowledge 4.6 version addressed a similar issue.
Any idea on the problem please?
Example of data file points.dat
4 4
4 -4
-4 4
-4 -4
The first line (4, 4) is skipped. So instead of four points, only three are displayed by gnuplot. Herewith the command am using
#!/bin/bash
set terminal epslatex 8 color standalone colortext
set output outputFileName
set size .55,.55
set pointsize 3.0
##############
# Line styles
##############
set linestyle 1 lt 5 lw 1 #
set linestyle 2 lt 2 lw 1.5
set linestyle 3 lt 6 lw 1 #
set linestyle 4 lt 3 lw 1
set linestyle 5 lt 2 lw 2 #
set linestyle 6 lt 1 lw 2
##################
# Titles
##################
set title 'Image'
set xlabel '$x$' offset 0,0.5
set ylabel '$y$' offset 2,0
set macros
filename_init = sprintf("%s/image_init.dat",dataFileDirectory)
set key autotitle columnhead
set key horiz
set multiplot
plot
filename_init u 1:2 with points lt 0 pt 1 lw 5 lc rgb "magenta" notitle 'initial'
On trick to bypass the issue is to duplicate the first row. Bu this is not practical.
With set key autotitle columnheader gnuplot uses the entries in the first row as key entries, even though for the plot you have specified notitle.
To demonstrate this, consider the following script, using the four data points in points.dat, which you posted:
set terminal pngcairo
set output 'foobar.png'
set offsets 1,1,1,1
set key autotitle columnhead
filename_init = 'points.dat'
set multiplot layout 1,2
plot filename_init u 1:2 with points lt 0 pt 1 lw 5 lc rgb "magenta"
set key noautotitle
plot filename_init u 1:2 with points lt 0 pt 1 lw 5 lc rgb "magenta" title 'initial'
unset multiplot
The result is
So, just remove the line set key autotitle columnhead from your script, and use plot ... title 'initial'. That gives you the expected result.

Resources