Font in Gnuplot Postscript Terminal - gnuplot

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.

Related

Gnuplot: Tilde Symbol in pngcairo image

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):

gnuplot linux to windows

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

FFMPEG, how to create custom waveform

I have done research trying to create a waveform with FFMPEG and am currently able to create a white png with the wave being transparent. The goal is to generate the wave like the smooth wave below and have the grey be transparent.
Here is my current FFMPEG waveform generator and output.
ffmpeg -i ./_test.mp3 -filter_complex \
"[0:a]aformat=channel_layouts=mono,compand=gain=-6, \
showwavespic=s=450x46:colors=white,negate[a]; \
color=white:450x46[c]; \
[c][a]alphamerge" -vframes 1 _test.png
You won't be able to do this in FFmpeg, one because the waveform isn't drawn with a line, but filled polygons, and two because FFmpeg seems to have trouble dealing with millisecond duration audio.
It would probably be possible to do this using more advanced math/plotting software like R, Octave or matplotlib, but my first thought was to use three smaller more specialized command line utilities:
SoX to trim, resample and save an audio file to a parseable .dat format
(grep/sed to clean up the .dat file)
Gnuplot to draw a plot based on that .dat file and save as .png
Imagemagick to modify the .png so that the plotted line is transparent
In the end my example script ended up like this
# create example file
sox -n -r 32k -b 16 pnoise.wav synth 10 pinknoise norm -0.1
# trim/convert
sox --norm=-1 pnoise.wav test.dat remix 1 trim 5 0.002 rate 200k
grep -v "^;" test.dat |\
sed -e "s/^[[:space:]]*//" -e "s/[[:space:]]*$//" > test.txt
# draw plot
gnuplot
set term png size 600,200 background "#BBBBBB"
set output "test.png"
unset key
unset border
unset xtics
unset ytics
set margins 0, 0, 0, 0
set yrange [-1:1]
plot "test.txt" with lines lt rgb "#FF0000" lw 3
exit
# replace red opaque with fully transparent
mogrify -channel rgba -matte -fill "#FF000000" -opaque "#FF0000" test.png

Gnuplot scripting set terminal gives me ascii characters

I am trying to run gnuplot script in xubuntu that had worked last months but from today it gives me ascii characters and not the desired png file with plot. I track the problem and seems that is at set terminal command.
Any idea?
#!/usr/bin/gnuplot
reset
set terminal png size 1024,768
set xlabel "Time"
set ylabel "Position"
set title "Title1"
set key reverse Left outside
set grid
set style data lines
plot "file.txt" using 1:2 title "North", \
"" using 1:3 title "East", \
"" using 1:4 title "Up" #
Finally found a solution,
worked only gif file so i sudo apt-get purge gnuplot* and reinstall sudo apt-get install libgd2-noxpm-dev then reinstall sudo apt-get install gnuplot-x11 and everything works!!!!!

plot is not generated (gnuplot from command line)

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.

Resources