Sample Header Ad - 728x90

Unix & Linux Stack Exchange

Q&A for users of Linux, FreeBSD and other Unix-like operating systems

Latest Questions

1 votes
1 answers
2687 views
Best way to generate pdf output from gnuplot
I have many data files in a directory. Each data file has various columns and I want vector plots using a few of them. Earlier I was generating .png files using a .gp script and combining them into a movie. I need outputs in PDF format also for showing in presentation and including in articles. The...
I have many data files in a directory. Each data file has various columns and I want vector plots using a few of them. Earlier I was generating .png files using a .gp script and combining them into a movie. I need outputs in PDF format also for showing in presentation and including in articles. The png script is:
set terminal pngcairo
set xla 'x'
set yla 'y'
scl=3
do for [i=0:10000:200]{
    set output sprintf('vector_frame%04.0f.png',i)
    plot 'data.'.i.'.dat' u 3:4:($5/scl):($6/scl) w vec ti sprintf("frame %d",i)
    set output
The resolution of png images is much poorer than that of the qt terminal and the plots are often not of much help. The pdf outputs from pdfcairo are also not good. In addition, there are situations where I have to `set size ratio 2'. There the _labels on the x-axis overlap_. The code and a sample output are given blow.
set terminal pngcairo
set xla 'x'
set yla 'y'
set size ratio 2
scl=3
set output 'pngeg.png'
plot 'data.2000.dat' u 3:4:($5/scl):($6/scl) w vec
png output from pngcairo I want to know what is the best way to save gnuplot vector plots in a form which is closest to the qt output and of good resolution. I need to do thousands of such plots in multiple directories. So a _script_ to do the same would be very helpful. I require outputs in **PDF** format. However, can pdf files be combined to make a movie or animation? Otherwise, I would need png images also. I am new to gnuplot and some detailed advice would be a saviour. Thank you.
damaihati (143 rep)
Jul 27, 2023, 06:17 AM • Last activity: Jun 30, 2025, 02:24 AM
0 votes
1 answers
2029 views
working directory in gnuplot
How do I specify the **working directory** for **gnuplot** in interactive mode? If I want to call a script with `"call 'label_loop.gnu'"` and do not want to put the script file in the gnuplot installation folder, do I need to specify the full path each time? I think the following would be the case w...
How do I specify the **working directory** for **gnuplot** in interactive mode? If I want to call a script with "call 'label_loop.gnu'" and do not want to put the script file in the gnuplot installation folder, do I need to specify the full path each time? I think the following would be the case with normal usage. "I put the data or script I want to load in any directory"-> "I plot it in interactive mode"-> "I want to adjust the position of the label (preferably) with the mouse action"- > "I copy and paste the previous commands and I create a batch file"-> "GnuPlot converts the output to PDF"
user15181 (9 rep)
Feb 17, 2020, 01:27 AM • Last activity: May 26, 2025, 09:00 PM
0 votes
1 answers
2724 views
how can I include an image file into a gnuplot-generated file?
I have a small image (*.eps or *.pdf) and want to include it into a gnuplot-generated file (based on regular data). I mean is there any command or trick that would put my external image in like a legend? Using "multiplot" doesn't seem to help; I could not find a good idea in the nice Kawano's site e...
I have a small image (*.eps or *.pdf) and want to include it into a gnuplot-generated file (based on regular data). I mean is there any command or trick that would put my external image in like a legend? Using "multiplot" doesn't seem to help; I could not find a good idea in the nice Kawano's site either... Any helpful idea? (Oh, I have gnuplot 4.4 release, and use a 14,04 ubuntu, if this helps...)
Al Kap (111 rep)
Jan 24, 2018, 03:19 AM • Last activity: Mar 31, 2025, 08:06 AM
0 votes
1 answers
28 views
Plotutils / Plotfont: get specific character (HPGL) code
> GNU plotfont is a simple utility that will produce a character map for any font available to the GNU plotting utilities graph, plot, pic2plot, and tek2plot, and the GNU libplot graphics library on which they are based. https://www.gnu.org/software/plotutils/manual/en/html_node/plotfont-Examples.ht...
> GNU plotfont is a simple utility that will produce a character map for any font available to the GNU plotting utilities graph, plot, pic2plot, and tek2plot, and the GNU libplot graphics library on which they are based. https://www.gnu.org/software/plotutils/manual/en/html_node/plotfont-Examples.html#plotfont-Examples example: plotfont -T hpgl HersheySans Will produce a character map of the HersheySans in HPGL code. The code contains all the characters and they don't seem to be *separated or independant from each other*. How do I get only a specific character HPGL code with plotfont? Is there an other tool that would allow me to do this?
e___e (55 rep)
Apr 22, 2024, 02:51 PM • Last activity: Apr 23, 2024, 03:51 PM
2 votes
1 answers
485 views
can't install gnuplot
I am using gnuplot and Rust for a project on my Linux Mint (cinnamon) PC. However once I try to display a picture I get: ``` called `Result::unwrap()` on an `Err` value: Couldn't spawn gnuplot. Make sure it is installed and available in PATH. Cause: No such file or directory (os error 2) ``` This se...
I am using gnuplot and Rust for a project on my Linux Mint (cinnamon) PC. However once I try to display a picture I get:
called Result::unwrap() on an Err value: Couldn't spawn gnuplot. Make sure it is installed and available in PATH.
Cause: No such file or directory (os error 2)
This seems ok as I haven't downloaded Gnuplot. However once i run
sudo apt install gnuplot
I get
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Package gnuplot-x11 is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
and I have no idea what I should do now. Any help is apreciated, thanks EDIT: I already ran
apt update
and apt policy returns
Package files:
 100 /var/lib/dpkg/status
     release a=now
 500 http://packages.microsoft.com/repos/code  stable/main armhf Packages
     release o=code stable,a=stable,n=stable,l=code stable,c=main,b=armhf
     origin packages.microsoft.com
 500 http://packages.microsoft.com/repos/code  stable/main arm64 Packages
     release o=code stable,a=stable,n=stable,l=code stable,c=main,b=arm64
     origin packages.microsoft.com
 500 http://packages.microsoft.com/repos/code  stable/main amd64 Packages
     release o=code stable,a=stable,n=stable,l=code stable,c=main,b=amd64
     origin packages.microsoft.com
 500 http://security.ubuntu.com/ubuntu  jammy-security/multiverse i386 Packages
     release v=22.04,o=Ubuntu,a=jammy-security,n=jammy,l=Ubuntu,c=multiverse,b=i386
     origin security.ubuntu.com
 500 http://security.ubuntu.com/ubuntu  jammy-security/multiverse amd64 Packages
     release v=22.04,o=Ubuntu,a=jammy-security,n=jammy,l=Ubuntu,c=multiverse,b=amd64
     origin security.ubuntu.com
 500 http://security.ubuntu.com/ubuntu  jammy-security/universe i386 Packages
     release v=22.04,o=Ubuntu,a=jammy-security,n=jammy,l=Ubuntu,c=universe,b=i386
     origin security.ubuntu.com
 500 http://security.ubuntu.com/ubuntu  jammy-security/universe amd64 Packages
     release v=22.04,o=Ubuntu,a=jammy-security,n=jammy,l=Ubuntu,c=universe,b=amd64
     origin security.ubuntu.com
 500 http://security.ubuntu.com/ubuntu  jammy-security/restricted i386 Packages
     release v=22.04,o=Ubuntu,a=jammy-security,n=jammy,l=Ubuntu,c=restricted,b=i386
     origin security.ubuntu.com
 500 http://security.ubuntu.com/ubuntu  jammy-security/restricted amd64 Packages
     release v=22.04,o=Ubuntu,a=jammy-security,n=jammy,l=Ubuntu,c=restricted,b=amd64
     origin security.ubuntu.com
 500 http://security.ubuntu.com/ubuntu  jammy-security/main i386 Packages
     release v=22.04,o=Ubuntu,a=jammy-security,n=jammy,l=Ubuntu,c=main,b=i386
     origin security.ubuntu.com
 500 http://security.ubuntu.com/ubuntu  jammy-security/main amd64 Packages
     release v=22.04,o=Ubuntu,a=jammy-security,n=jammy,l=Ubuntu,c=main,b=amd64
     origin security.ubuntu.com
 500 https://mirror.init7.net/linuxmint  vera/backport i386 Packages
     release v=21.1,o=linuxmint,a=vera,n=vera,l=linuxmint,c=backport,b=i386
     origin mirror.init7.net
 500 https://mirror.init7.net/linuxmint  vera/backport amd64 Packages
     release v=21.1,o=linuxmint,a=vera,n=vera,l=linuxmint,c=backport,b=amd64
     origin mirror.init7.net
 500 https://mirror.init7.net/linuxmint  vera/import i386 Packages
     release v=21.1,o=linuxmint,a=vera,n=vera,l=linuxmint,c=import,b=i386
     origin mirror.init7.net
 500 https://mirror.init7.net/linuxmint  vera/import amd64 Packages
     release v=21.1,o=linuxmint,a=vera,n=vera,l=linuxmint,c=import,b=amd64
     origin mirror.init7.net
 700 https://mirror.init7.net/linuxmint  vera/upstream i386 Packages
     release v=21.1,o=linuxmint,a=vera,n=vera,l=linuxmint,c=upstream,b=i386
     origin mirror.init7.net
 700 https://mirror.init7.net/linuxmint  vera/upstream amd64 Packages
     release v=21.1,o=linuxmint,a=vera,n=vera,l=linuxmint,c=upstream,b=amd64
     origin mirror.init7.net
 500 https://mirror.init7.net/linuxmint  vera/main i386 Packages
     release v=21.1,o=linuxmint,a=vera,n=vera,l=linuxmint,c=main,b=i386
     origin mirror.init7.net
 500 https://mirror.init7.net/linuxmint  vera/main amd64 Packages
     release v=21.1,o=linuxmint,a=vera,n=vera,l=linuxmint,c=main,b=amd64
     origin mirror.init7.net
 500 https://dl.google.com/linux/chrome/deb  stable/main amd64 Packages
     release v=1.0,o=Google LLC,a=stable,n=stable,l=Google,c=main,b=amd64
     origin dl.google.com
 500 https://cli.github.com/packages  stable/main amd64 Packages
     release o=gh,n=stable,l=gh,c=main,b=amd64
     origin cli.github.com
 500 http://security.ubuntu.com/ubuntu  focal-security/main i386 Packages
     release v=20.04,o=Ubuntu,a=focal-security,n=focal,l=Ubuntu,c=main,b=i386
     origin security.ubuntu.com
 500 http://security.ubuntu.com/ubuntu  focal-security/main amd64 Packages
     release v=20.04,o=Ubuntu,a=focal-security,n=focal,l=Ubuntu,c=main,b=amd64
     origin security.ubuntu.com
 500 https://apt.kitware.com/ubuntu  focal/main i386 Packages
     release o=ubuntu focal,a=focal,n=focal,l=ubuntu focal,c=main,b=i386
     origin apt.kitware.com
 500 https://apt.kitware.com/ubuntu  focal/main amd64 Packages
     release o=ubuntu focal,a=focal,n=focal,l=ubuntu focal,c=main,b=amd64
     origin apt.kitware.com
 500 https://cloud.r-project.org/bin/linux/ubuntu  bionic-cran40/ Packages
     release v=18.04,o=CRAN,a=bionic-cran40,n=bionic-cran40,l=CRAN,c=
     origin cloud.r-project.org
Pinned packages:
     snapd -> 2.58+22.04.1 with priority -10
     snapd -> 2.58+20.04.1 with priority -10
Beppe (23 rep)
Jan 30, 2024, 02:04 PM • Last activity: Jan 30, 2024, 02:39 PM
0 votes
1 answers
141 views
How to use a bash output as a variable in gnuplot? OpenFOAM log examples
I have a log file like this: Starting time loop Courant Number mean: 0 max: 0 deltaT = 0.0012 Time = 0.0012 DILUPBiCGStab: Solving for Ux, Initial residual = 1, Final residual = 4.8276e-08, No Iterations 1 DILUPBiCGStab: Solving for Uy, Initial residual = 1, Final residual = 2.23172e-07, No Iteratio...
I have a log file like this: Starting time loop Courant Number mean: 0 max: 0 deltaT = 0.0012 Time = 0.0012 DILUPBiCGStab: Solving for Ux, Initial residual = 1, Final residual = 4.8276e-08, No Iterations 1 DILUPBiCGStab: Solving for Uy, Initial residual = 1, Final residual = 2.23172e-07, No Iterations 1 DILUPBiCGStab: Solving for Uz, Initial residual = 1, Final residual = 2.80701e-08, No Iterations 1 DILUPBiCGStab: Solving for T, Initial residual = 0.999922, Final residual = 4.3295e-07, No Iterations 1 DICPCG: Solving for p_rgh, Initial residual = 1, Final residual = 0.00904671, No Iterations 163 time step continuity errors : sum local = 8.39133e-07, global = -8.63793e-09, cumulative = -8.63793e-09 DILUPBiCGStab: Solving for epsilon, Initial residual = 0.00291157, Final residual = 2.1992e-06, No Iterations 1 DILUPBiCGStab: Solving for k, Initial residual = 1, Final residual = 0.00101111, No Iterations 1 ExecutionTime = 2.53 s ClockTime = 3 s Courant Number mean: 0.00447015 max: 0.356735 deltaT = 0.00143547 Time = 0.00263547 DILUPBiCGStab: Solving for Ux, Initial residual = 0.334632, Final residual = 3.26106e-05, No Iterations 1 DILUPBiCGStab: Solving for Uy, Initial residual = 0.325756, Final residual = 1.62512e-05, No Iterations 1 DILUPBiCGStab: Solving for Uz, Initial residual = 0.379719, Final residual = 2.45476e-05, No Iterations 1 DILUPBiCGStab: Solving for T, Initial residual = 0.110323, Final residual = 1.51228e-05, No Iterations 1 DICPCG: Solving for p_rgh, Initial residual = 0.135502, Final residual = 0.00128893, No Iterations 152 time step continuity errors : sum local = 3.78267e-06, global = 5.94272e-08, cumulative = 5.07892e-08 DILUPBiCGStab: Solving for epsilon, Initial residual = 0.0132143, Final residual = 9.90056e-06, No Iterations 1 DILUPBiCGStab: Solving for k, Initial residual = 0.27268, Final residual = 0.000279373, No Iterations 1 ExecutionTime = 3.86 s ClockTime = 4 s and my gnuplot script is like this: set terminal png set output 'res.png' set logscale y set title "Residuals" set ylabel 'Residual' set xlabel 'Time [s]' dt = 0.001 plot "< cat log | grep 'Solving for Ux' | cut -d' ' -f9 | tr -d ','" using ($0*dt):1 title 'Ux' with lines,\ "< cat log | grep 'Solving for Uy' | cut -d' ' -f9 | tr -d ','" using ($0*dt):1 title 'Uy' with lines,\ "< cat log | grep 'Solving for Uz' | cut -d' ' -f9 | tr -d ','" using ($0*dt):1 title 'Uz' with lines,\ "< cat log | grep 'Solving for T' | cut -d' ' -f9 | tr -d ','" using ($0*dt):1 title 'T' with lines,\ "< cat log | grep 'Solving for p' | cut -d' ' -f9 | tr -d ','" using ($0*dt):1 title 'p' with lines set terminal x11 set output replot pause 1 reread Basically, it grabs the "Solving for Ux", then get the 1st number at "Initial residual" then plot it. Each block (starting from Courant Number mean to Clocktime) is 1 iteration. The real time is iteration * deltaT. So, 1st iteration is 0.0012 sec, 2nd, iteration is 2*0.00143547 = 0.0028 sec....etc. If the deltaT is constant, then I can just set it like the script above and multiply it when plotting, e.g. using ($0*dt):1. Then from above, I just set a single value for dt. However, my deltaT changes so how do we contribute this to the code? I can use the following bash command to get the values for deltaT: cat log | grep -v -e 'ClockTime =' -e 'ExecutionTime = ' -e 'Solving for' -e 'time step' -e 'Courant' -e 'Time' | cut -d' ' -f3 | tr -cd '[:digit:].\n' But I do not know how to set these as variables to plot. I tried: dt = "cat log | grep -v -e 'ClockTime =' -e 'ExecutionTime = ' -e 'Solving for' -e 'time step' -e 'Courant' -e 'Time' | cut -d' ' -f3 | tr -cd '[:digit:].\n'" but couldnt plot it. Gnuplot gave something like "error in piping".
mle0312 (163 rep)
Jan 10, 2024, 07:17 AM • Last activity: Jan 10, 2024, 04:23 PM
1 votes
2 answers
414 views
How to pass a bash variable (list of numeric data) to gnuplot *without using a file*
I am using netcat to get a series of points which I would like to plot with gnuplot. However, I am having trouble passing the data to gnuplot without writing it to a file first. In the simplest case, I want to plot a 3-point line that I've defined in a variable first as follows: ``` #!/bin/bash DATA...
I am using netcat to get a series of points which I would like to plot with gnuplot. However, I am having trouble passing the data to gnuplot without writing it to a file first. In the simplest case, I want to plot a 3-point line that I've defined in a variable first as follows:
#!/bin/bash

DATA="10
12
15"

echo "$DATA"

# Data looks good in terminal (single vertical column of numbers 10, 12, 15)
# However, the following step doesn't work:

gnuplot -persist  tempfile.csv


gnuplot -persist <<-EOFMarker
	plot "tempfile.csv" w lines
EOFMarker
Sebastian (11 rep)
Aug 22, 2023, 06:18 PM • Last activity: Aug 25, 2023, 06:21 PM
0 votes
1 answers
1287 views
gnuplot - Histogram bars in different colors with the values on top
I have this data file (`TotalDurationBarPlot.dat`): ``` Indexed list 934 Tree list 3692 Array list 12274 Linked list 48188 ``` What I wish to achieve is a histogram chart with 4 bars: one for **Indexed list**, one for **Tree list**, one for **Array list**, one for **Linked list**. My requirements ar...
I have this data file (TotalDurationBarPlot.dat):
Indexed list 934
Tree list 3692
Array list 12274
Linked list 48188
What I wish to achieve is a histogram chart with 4 bars: one for **Indexed list**, one for **Tree list**, one for **Array list**, one for **Linked list**. My requirements are: 1. Each bar has it's unique color, 2. On top of each bar, there is a number denoting the height of the bar. (For example, above the **Tree list**, there is **3692**.) 3. It would be nice to have a legend on a light gray background with a thin black legend border at the top right corner. **My current attempt** As of now, my data file looks like:
# ILL TL AL LL
934 3692 12274 48188
... and my gnuplot script looks like:
set title font "Monospaced,13" 'Total duration'
set grid
set key right top
set style data histograms
set style histogram cluster gap 2
set style fill solid border 2
set xtics format ""
set grid ytics
set ylabel "Milliseconds"
set yrange [0:70000]
# set boxwidth 0.5 relative
# set label "Array list\n134908 ms" at graph 0.145,0.9

ArrayListColor   = "#491d75";
IndexedListColor = "#b32929";
LinkedListColor  = "#d49435";
TreeListColor    = "#12520b";

plot 'TotalDurationBarPlot.dat' using 1 title "Indexed list" linecolor rgb IndexedListColor, '' using 2 title "Tree list" linecolor rgb TreeListColor, '' using 3 title "Array list" linecolor rgb ArrayListColor, '' using 4 title "Linked list" linecolor rgb LinkedListColor, '' u 0:1:1 with labels offset -6.0,-100.0 title ""

set terminal png size 650,350 enhanced font "Monospaced,13"
set output 'TotalDuration.png'
replot
exit
It produces: List comparison **Edit 1** The gnuplot code provided in the answer by [@meuh](https://unix.stackexchange.com/users/119298/meuh) produces the following plot: Bad bars
coderodde (53 rep)
May 20, 2023, 06:07 PM • Last activity: May 30, 2023, 10:56 AM
2 votes
2 answers
270 views
How to remove lines with nonsense format numbers?
I have the following data that I am processing to get the 1st and 5th column, convert the `D` format to `E` format and delete rows that have gibberish numbers such as `9.410-316`. ```text DEG = 1.500 2.600D+01 0.000D+00 0.000D+00 0.000D+00 0.000D+00 2.700D+01 8.720-304 2.369-316 7.556-316 9.410-316...
I have the following data that I am processing to get the 1st and 5th column, convert the D format to E format and delete rows that have gibberish numbers such as 9.410-316.
DEG =      1.500
	 2.600D+01     0.000D+00     0.000D+00     0.000D+00     0.000D+00
     2.700D+01     8.720-304     2.369-316     7.556-316     9.410-316
     4.300D+01     1.208D-83     4.156D-96     7.360D-96     6.984D-96
     1.590D+02     8.002D-07     6.555D-19     7.748D-19     7.376D-19
     1.600D+02     1.173D-06     9.669D-19     1.143D-18     1.089D-18
     1.610D+02     1.709D-06     1.417D-18     1.676D-18     1.596D+01
     1.620D+02     2.468D-06     2.058D-18     2.436D-18     2.320D-10
DEG =     18.500 
     2.700D+01     2.794-314     0.000D+00     0.000D+00     0.000D+00
     2.800D+01     4.352-285     1.224-297     3.685-297     4.412-297
     8.800D+01     1.371D-02     6.564D-15     7.852D-15     7.275D-15
My problem is in identifying the number formats that I want to delete. So far, I have tried
-bash
maxa=18.5
maxangle=$(printf "%.3f" $maxa)
if (( $(echo "$maxa 10, else only 5)
else
  txt2search="DEG =     $maxangle"
fi

line=$(grep -n "$txt2search" file  | cut -d : -f 1)

# Once the line number is read for the string, skip a few lines (4) and read next several lines(1000)
beginline=$((line + 4))
endline=$((line + 1002))
awk -v a="$beginline" -v b="$endline" 'NR==a, NR==b {print $1, $5}' fileinput > fileoutput
sed -i 's/D/E/g' fileoutput
Then, to discard the rows with the nonsense numbers, I tried (one at a time) and failed with the following commands.
-bash
sed -ni '/E/p' fileoutput
sed -E '/(E)/!d' fileoutput > spec2.tempdata
sed '/E/!d' fileoutput > spec2.tempdata
awk '!/E/' fileoutput > spec2.tempdata
How can I identify and remove lines with such nonsense numbers? The versions are * sed (GNU sed) 4.7 * grep (GNU grep) 3.4 * GNU Awk 5.0.1, API: 2.0 (GNU MPFR 4.0.2, GNU MP 6.2.0) The output would be
2.600D+01     0.000D+00     0.000D+00     0.000D+00     0.000D+00
4.300D+01     1.208D-83     4.156D-96     7.360D-96     6.984D-96
1.590D+02     8.002D-07     6.555D-19     7.748D-19     7.376D-19
1.600D+02     1.173D-06     9.669D-19     1.143D-18     1.089D-18
1.610D+02     1.709D-06     1.417D-18     1.676D-18     1.596D+01
1.620D+02     2.468D-06     2.058D-18     2.436D-18     2.320D-10
**EDIT:** The solution that I was looking for is (see first comment)
-bash
grep -v '[0-9]-'
csnl (35 rep)
Apr 11, 2023, 04:57 PM • Last activity: Apr 16, 2023, 10:16 PM
1 votes
2 answers
178 views
Gnuplot -e not working on Debian 11
E.g. the following command ``` gnuplot -e "splot [x=-3:3] [y=-3:3] sin(x)*cos(y)" ``` works perfectly fine on Windows 10 with GNUPLOT 5.4p5. But on my Debian Bullseye box with GNUPLOT 5.4p1 all I get is the following error: ``` line 0: undefined variable: ``` Running GNUPLOT without arguments and ex...
E.g. the following command
gnuplot -e "splot [x=-3:3] [y=-3:3] sin(x)*cos(y)"
works perfectly fine on Windows 10 with GNUPLOT 5.4p5. But on my Debian Bullseye box with GNUPLOT 5.4p1 all I get is the following error:
line 0: undefined variable:
Running GNUPLOT without arguments and executing the same command from GNUPLOT command prompt works as expected; a window appears with the plot. Is this some kind of command line parsing issue, or something to do with the character set/locale?
huoneusto (131 rep)
Oct 30, 2022, 09:51 AM • Last activity: Oct 31, 2022, 12:08 PM
1 votes
0 answers
144 views
gnuplot: add values above the bars
My script takes the data from the third and 5th columns of the input datafile considering only the lines where the value from the 5th column > 0.05, producing a bar graph cat graph.png set term pngcairo size 800,600 set xtics noenhanced set xlabel "Fraction, %" set ylabel "H-bond donor, residue" set...
My script takes the data from the third and 5th columns of the input datafile considering only the lines where the value from the 5th column > 0.05, producing a bar graph cat graph.png set term pngcairo size 800,600 set xtics noenhanced set xlabel "Fraction, %" set ylabel "H-bond donor, residue" set key off set style fill solid 0.5 set boxwidth 0.9 plot " 0.05' $file" using 0:5:xtic(3) with boxes EOS I need to modify my gnuplot ploting function to indicate the value corresponded to Y (Frac) above each bar on the plot. I've already tried to add using 1:2 with labels: plot " 0.05' $file" using 0:5:xtic(3) with boxes,\ " 0.05' $file" using 1:2:2 with labels
James Starlight (137 rep)
Oct 5, 2022, 03:03 PM
2 votes
0 answers
135 views
xmgrace: bar graph vizualisation using batch
I am using xmgrace to plot 2D bar plot from the following input data: @ title "H-bonds" @ xaxis label "Donor" @ yaxis label "Frac" @s0 line type 0 @s0 symbol linewidth 1 @s0 symbol fill pattern 1 @s0 symbol fill color 4 @TYPE bar @XAXIS TICK MAJOR 1 GLU_166@N 0.6865 HIE_163@NE2 0.4160 ASN_142@ND2 0....
I am using xmgrace to plot 2D bar plot from the following input data: @ title "H-bonds" @ xaxis label "Donor" @ yaxis label "Frac" @s0 line type 0 @s0 symbol linewidth 1 @s0 symbol fill pattern 1 @s0 symbol fill color 4 @TYPE bar @XAXIS TICK MAJOR 1 GLU_166@N 0.6865 HIE_163@NE2 0.4160 ASN_142@ND2 0.0788 THR_25@OG1 0.0109 as you may see all grace's options have already defined in the @ comments. so to produce the graph I need only to execute gracebat .dat -hdevice PNG -fixed 800 600 -world 0 0 5 1.0 -printfile test.png -hardcopy the problem is that the produced bar graph does not contain any information about the labels from the first columns (like THR_26@OG1 etc), producing something like enter image description here 1) visualization of the X labels: how could I use the labels on the X from the original data file instead of the values printed on default 1,2,3 etc ? I found the possibility to rename manually the X labels in gui but still have not find the command for batch execution. 2) visualization of the Y labels: would it be possible to plot the values of the fraction (Y) just above each bar directly on the bar graph (now they are indicated only on the Y)?
James Starlight (137 rep)
Oct 4, 2022, 10:04 AM • Last activity: Oct 5, 2022, 07:39 AM
1 votes
1 answers
1954 views
Bash script for plotting multiple files with Gnuplot
I want to plot several files just executing a bash script which calls Gnuplot. My idea of a possible bash script is: #!/bin/bash gnuplot plot 'my_first_file.dat' u 1:2 replot 'my_second_file.dat' u 1:2 let us call this bash script `gnuplot_script.sh`. When I execute this script via `$./gnuplot_scrip...
I want to plot several files just executing a bash script which calls Gnuplot. My idea of a possible bash script is: #!/bin/bash gnuplot plot 'my_first_file.dat' u 1:2 replot 'my_second_file.dat' u 1:2 let us call this bash script gnuplot_script.sh. When I execute this script via $./gnuplot_script.sh I only get gnuplot open in my terminal without the plots related to the script. What should I modify in the script in order to have my data plotted? This is my first time in the world of bash scripting.
Siderius (123 rep)
Jul 26, 2022, 04:53 PM • Last activity: Jul 26, 2022, 05:16 PM
2 votes
1 answers
255 views
Gnuplot Precission
Does anyone know whether there is a way to run gnuplot with quadruple arithmetic precision? E.g. When you want to plot a line and you want to subtract a value like "2.3403800935287029218841060098446498" from values that vary only right hand to the 16th digit from this value. Any input on this proble...
Does anyone know whether there is a way to run gnuplot with quadruple arithmetic precision? E.g. When you want to plot a line and you want to subtract a value like "2.3403800935287029218841060098446498" from values that vary only right hand to the 16th digit from this value. Any input on this problem is much appreciated.
Jannis Erhard (121 rep)
Sep 17, 2019, 05:22 PM • Last activity: May 2, 2022, 12:40 AM
2 votes
1 answers
290 views
How to change the number format in the gnuplot status bar?
I am plotting some financial data in gnuplot as candlesticks. Example of the data: ``` 2022-04-20T00:01:00 1.07907 1.07901 1.07916 1.07907 2022-04-20T00:02:00 1.07906 1.079 1.07908 1.07907 2022-04-20T00:03:00 1.07906 1.07898 1.07909 1.07905 2022-04-20T00:04:00 1.07906 1.07889 1.07906 1.07895 2022-04...
I am plotting some financial data in gnuplot as candlesticks. Example of the data:
2022-04-20T00:01:00 1.07907 1.07901 1.07916 1.07907
2022-04-20T00:02:00 1.07906 1.079 1.07908 1.07907
2022-04-20T00:03:00 1.07906 1.07898 1.07909 1.07905
2022-04-20T00:04:00 1.07906 1.07889 1.07906 1.07895
2022-04-20T00:05:00 1.07892 1.07889 1.07901 1.07895
2022-04-20T00:06:00 1.07894 1.07887 1.07894 1.07891
2022-04-20T00:07:00 1.07892 1.07887 1.07895 1.0789
2022-04-20T00:08:00 1.07892 1.07889 1.07904 1.07902
2022-04-20T00:09:00 1.07903 1.07901 1.07909 1.07903
2022-04-20T00:10:00 1.07904 1.079 1.07912 1.07903
2022-04-20T00:11:00 1.07902 1.079 1.07903 1.07902
2022-04-20T00:12:00 1.07903 1.07899 1.07905 1.07901
2022-04-20T00:13:00 1.07903 1.07899 1.07905 1.07902
2022-04-20T00:14:00 1.07901 1.07891 1.07905 1.07895
2022-04-20T00:15:00 1.07893 1.07886 1.07898 1.07887
2022-04-20T00:16:00 1.07888 1.07887 1.07898 1.07893
2022-04-20T00:17:00 1.07892 1.07892 1.07904 1.07901
2022-04-20T00:18:00 1.07902 1.079 1.07905 1.07902
For plotting, I use this script:
set mxtics 10
set mytics 10
set grid mxtics mytics
set xdata time
set timefmt "%Y-%m-%dT%H:%M:%S"
set format x "%H:%M:%S"
plot filename using 1:2:3:4:5 with candlesticks

pause mouse close
I execute gnuplot as follows: gnuplot -e "filename='/tmp/dat'" gnuplot_script.dat This works great, except for the status bar: enter image description here For the time/date, the status bar just displays a scientific notation of the unix timestamp (I guess). However, I would like to be able to read the specific time when moving the mouse cursor in the plot. Is it possible to change the format?
Philipp Ludwig (412 rep)
Apr 27, 2022, 04:58 PM • Last activity: Apr 28, 2022, 05:02 PM
1 votes
0 answers
1053 views
gnuplot doesn't show plotting window on Ubuntu
[![error from wxt][1]][1] [1]: https://i.sstatic.net/VISjC.png I was using gnuplot in Ubuntu with wxt terminal, and when I type in `plot sin(x)`, I get an error message: Unable to init server: Could not connect: Connection refused 23:00:40: Error: Unable to initialize GTK+, is DISPLAY set properly?...
error from wxt I was using gnuplot in Ubuntu with wxt terminal, and when I type in plot sin(x), I get an error message: Unable to init server: Could not connect: Connection refused 23:00:40: Error: Unable to initialize GTK+, is DISPLAY set properly? Failed to initialize wxWidgets.
Limona2000 (11 rep)
Nov 25, 2021, 11:12 PM
2 votes
1 answers
1208 views
Gnuplot: What is the difference between plot '/dev/stdin' and plot '-'?
When I use `'-'` to plot in gnuplot from a pipeline, as follows ⭐ : ``` $ seq 5 | gnuplot -e "plot '-' w lp; pause 99" ``` it works fine, I can adjust the plot's window size, can show/hide grid without any problem. But when I use `'/dev/stdin'` as follows: ``` $ seq 5 | gnuplot -e "plot '/dev/stdin'...
When I use '-' to plot in gnuplot from a pipeline, as follows⭐:
$ seq 5 | gnuplot -e "plot '-' w lp; pause 99"
it works fine, I can adjust the plot's window size, can show/hide grid without any problem. But when I use '/dev/stdin' as follows:
$ seq 5 | gnuplot -e "plot '/dev/stdin' w lp; pause 99"
It shows the plot but when I click to maximize the window, it crashes:
line 0: warning: Skipping data file with no valid points

plot '/dev/stdin' w lp
                      ^
line 0: x range is invalid
Could you please explain why does this happen? what is the difference between '-' and '/dev/stdin'? ------- ⭐ I am deliberately using pause instead of using -p option, because the latter doesn't allow interaction with the plot (no update after resize, can't show/hide grid from the toolbar,etc.)
👉️ I am using bash version 5.0.17 on Ubuntu 20.04, gnuplot 5.2 patchlevel 8, if that info is needed.
Iyach tharwa nambarek (123 rep)
Oct 1, 2021, 04:01 PM • Last activity: Oct 1, 2021, 09:34 PM
2 votes
0 answers
194 views
improve plot scale and display
I am trying to plot some data using `gnuplot` My input is similar to ``` $ go run . | tail 410ms-420ms 14260 420ms-430ms 13654 430ms-440ms 13344 440ms-450ms 13156 450ms-460ms 12829 460ms-470ms 12463 470ms-480ms 12883 480ms-490ms 12100 490ms-500ms 11902 500ms-510ms 11643 ``` The length of the dataset...
I am trying to plot some data using gnuplot My input is similar to
$ go run . | tail
410ms-420ms 14260
420ms-430ms 13654
430ms-440ms 13344
440ms-450ms 13156
450ms-460ms 12829
460ms-470ms 12463
470ms-480ms 12883
480ms-490ms 12100
490ms-500ms 11902
500ms-510ms 11643
The length of the dataset is 51 My command is
go run . | gnuplot -p -e 'set style d hist; set style fill solid; plot "-" u 2:xtic(1) linecolor 'black'   title "Counts by duration"'
My program, for those who have the Go language available is https://play.golang.org/p/DAIEY1YZ7LT My output is like enter image description here How can i improve the display so it is readable by an human ? Is it possible to show only a subsets of labels in the x axis ? Can the bottom indicator of pointer x y positions show the label instead of x value ?
mh-cbon (143 rep)
Aug 18, 2021, 06:17 PM • Last activity: Aug 18, 2021, 07:52 PM
0 votes
0 answers
201 views
use xgraph or gnuplot in ubuntu
I am using ns2.35 and ubuntu 18.040. I have a number of trace files and I want to compare them in terms of: delay, throughput, power consumption (awk files) .. I would like to use xgraph or gnuplot .. Is there an easy way to use them to compare a number of trace files at once?
I am using ns2.35 and ubuntu 18.040. I have a number of trace files and I want to compare them in terms of: delay, throughput, power consumption (awk files) .. I would like to use xgraph or gnuplot .. Is there an easy way to use them to compare a number of trace files at once?
sally (1 rep)
Jul 13, 2021, 03:26 AM
0 votes
2 answers
4739 views
gnuplot - line 0: unexpected or unrecognized token
code: ``` #!/usr/bin/env bash # download death data wget -O Deaths.txt http://www.randomservices.org/random/data/Deaths.txt wget -O Pumps.txt http://www.randomservices.org/random/data/Pumps.txt # Delete the first line sed 1d Deaths.txt > tempfile1 sed 1d Pumps.txt > tempfile2 # mv tempfile1 Deaths.t...
code:
#!/usr/bin/env bash
# download death data
wget -O Deaths.txt http://www.randomservices.org/random/data/Deaths.txt 
wget -O Pumps.txt http://www.randomservices.org/random/data/Pumps.txt 
# Delete the first line
sed 1d Deaths.txt > tempfile1
sed 1d Pumps.txt > tempfile2
# mv tempfile1 Deaths.txt
# mv tempfile2 Pumps.txt
gnuplot -persist -e "set terminal canvas;set xlabel 'x' font 'sans,15';
set ylabel 'y' font ',15';
set title 'Relationship between Deaths and Pumps' font 'sans, 20';
show title;
set label "Most of the deaths is near the pump located in 12.6,11.7" at 16,16;
show label;
set output 'death_pump_relation.html';
plot 'Pumps.txt' with points pt 7 ,'Deaths.txt' with dots;"
There is a error:
line 0: unexpected or unrecognized token
and I cannot get any output But in fact, there is no line0 in my script What is wrong with that? Version : gnuplot V5.2 System: MacOS
Yiling Liu (155 rep)
May 13, 2019, 02:56 AM • Last activity: Jul 8, 2021, 08:02 AM
Showing page 1 of 20 total questions