I am trying to create an EPS file using gnuplot using the following code:
set terminal postscript eps enhanced
set output 'file.eps'
plot 'mydata.dat' using 1:2
replot
quit
But to no avail, EPS file does not have any plot in there. I dont know what I am missing, i got ghostscript, ghostscript-fonts and psutils. EPS files is just empty white file. I have searched the web but nothing just works.
How to I generate the EPS file with plot in it?
Specs:
Fedora 21 x64_86
gnuplot-4.6 patch 5
ghostscript 9.15
"conf" :
set terminal postscript eps enhanced
set output 'file.eps'
plot 'mydata.dat' using 1:2 with linespoints
replot
quit
And you will need some data for the file mydata.dat, example from http://lowrank.net/gnuplot/datafile2-e.html , ref. https://www.google.com/webhp?hl=all&gws_rd=ssl#hl=en&q=gnuplot+plot+file
# X Y1 Y2
1.0 0.0 0.1
2.0 0.0 0.1
3.0 0.0 0.1
4.0 0.1 0.2
5.0 0.6 0.4
6.0 1.0 0.9
7.0 1.2 1.7
8.0 1.3 2.4
$ gnuplot conf : OK, a nice plot, file.eps .
Ok, I have now solved it, It appears that there is a conflict between ghostscript and infinality so I uninstalled it
sudo yum remove *infinality*
and Viola! Things works now! :)
Related
I use Gnuplot with pngcairo terminal and my question ison can I put the tilde symbol on a letter?
I know that in latex the command is \tilde{f}.
I've tried with f{\Symbol 304} or f\\~.
How can I do?
Check help enhanced text.
With this:
### tilde over character
set label 1 "~f{0.9\\~}" at screen 0.25, 0.75 font ",20"
plot x
You get the following (wxt terminal):
I am running the below Gnuplot code in Linux.
I want to know how I can run the same code on windows?
Thanks a lot!
reset
set termoption dash
set terminal postscript portrait enhanced color "Helvetica" 10
set output '| ps2pdf - Plot.pdf'
set datafile separator ","
mag = 5
set grid
set border 31 lw 1
set key off
set style line 1 lt 1 lw 10 pt 6 ps 0.4 lc rgb '#D3D3D3'
TET_0011 = "/home/soheil/university/quadratic/KAPPA & MU/TET-VOIGT-SR-0.01.txt"
plot TET_0011 u 1:4 w l ls 1 title "VOIGT"
Gnuplot is supported on windows using Cygwin or MinGW.
Checkout the binary download page for gnuplot windows binaries.
The gnuplot code you post above will remain the same.
The only problem i see on windows is the lack os ps2pdf
Fortunately, you could set to generate PDF directly, instead of set terminal postscript ... you should have pdfcairo terminal
set terminal pdfcairo OPTIONS
It is available on gnuplot on windows, v5.0.x
I'm trying to get part of the answer in https://stackoverflow.com/a/27534509/257924 to work but am running into a Bad format character error.
Only when I comment out the set table command below, do I get the error (execute this as a script on Linux). Below, I'm expecting /tmp/temporaryfile.dat to be generated and not a plot image file:
#!/bin/bash
datafile=/tmp/mydata.1
cat > $datafile <<EOF
2013/5/1 1
2013/5/1 1
2013/5/1 1
2013/6/1 2
2013/6/1 2
EOF
gnuplot_in=/tmp/gnuplot.in
gnuplot_out=/tmp/gnuplot.png
cat > $gnuplot_in <<EOF
set xdata time
set timefmt '%Y/%m/%d'
set table '/tmp/temporaryfile.dat'
set format x '%Y/%m/%d'
plot "$datafile" using (timecolumn(1)):2 title "thetitle" with linespoints;
unset table
EOF
# Show the input with line numbers for debugging:
grep -n '.*' $gnuplot_in
gnuplot $gnuplot_in
#eog $gnuplot_out
The error is:
1: set xdata time
2: set timefmt '%Y/%m/%d'
3: set table '/tmp/temporaryfile.dat'
4: set format x '%Y/%m/%d'
5: plot "/tmp/mydata.1" using (timecolumn(1)):2 title "thetitle" with linespoints;
6: unset table
"/tmp/gnuplot.in", line 5: Bad format character
I've already checked the script for accidental UNICODE characters as indicated by gnuplot error: Bad format character
What would cause this error and how do I fix it?
I've concluded that this is due to a bug in the version of gnuplot on my RHEL 6.6 machine. On my RHEL 6.6 machine we have this version of gnuplot:
gnuplot 4.2 patchlevel 0
On my Debian system, the script works without errors, using this version of gnuplot:
gnuplot 4.6 patchlevel 0
In sample.dat I have:
set terminal pngcairo transparent enhanced font "arial,10" fontscale 1.0 size 500, 350
set output 'simple.2.png'
plot [-pi/2:pi] cos(x),-(sin(x) > sin(x+1) ? sin(x) : sin(x+1))
From ubuntu/terminal I execute:
gnuplot -e "filename='sample.dat'"
but the simple.2.png file is not created. How do I export a plot to e.g png using gnuplot from command line?
I have no idea where you got that from!
To execute a gnuplot script (here called simple.gp), simply call
gnuplot simple.gp
You should keep the extension .dat for data files.
I would like gnuplot to use the same font in the postscript-terminal as it does in the wxt-terminal. The Gnuplot help says that wxt uses "Sans" by default. Now, if i set the terminal to
gnuplot> set term post enhanced color "Sans" 12
Terminal type set to 'postscript'
Options are 'landscape enhanced defaultplex \
leveldefault color colortext \
dashed dashlength 1.0 linewidth 1.0 butt noclip \
palfuncparam 2000,0.003 \
"Sans" 12 '
then the font looks very different to the one in wxt.
I am using Ubuntu 10.04 lucid.
Which font would you suggest me to use? Any ideas welcome.
I've also tried "cm-super" to get latex-fonts (computer modern) in gnuplot. Actually it worked, but the text overlapped boxes and margins very often!
Greets,
mefiX
Since the considered plots are part of a LaTeX document, I decided to use the computer modern fonts described earlier.
gnuplot> set term post enhanced color fontfile "/usr/share/texmf/fonts/type1/public/cm-super/sfss1200.pfb" "SFSS1200"
Terminal type set to 'postscript'
Font file '/usr/share/texmf/fonts/type1/public/cm-super/sfss1200.pfb' contains the font 'SFSS1200'. Location:
/usr/share/texmf/fonts/type1/public/cm-super/sfss1200.pfb
Options are 'landscape enhanced defaultplex \
leveldefault color colortext \
dashed dashlength 1.0 linewidth 1.0 butt noclip \
palfuncparam 2000,0.003 \
"SFSS1200" 14 fontfile "/usr/share/texmf/fonts/type1/public/cm-super/sfss1200.pfb" '
As already mentioned, you can install these under ubuntu by calling
# apt-get install cm-super
on the root command line.
Note that the characters in SFSS1200 describe font encoding (Latin1, ...), style (Sans-Serif, ...) and desired resolution in dpi.