Symbols in gnuplot - gnuplot

I thought I knew how the {/Symbol x} worked in gnuplot but I don't. I need to get a partial derivative symbol (utf8 code U+2202), and I can't. How could I do it. I haven't found anything online. This is the document settings:
set terminal postscript eps enhanced color font "Helvetica, 20"
set encoding utf8
Thank you

If you really need to use a postscript terminal, use
{/Symbol \266}
Your gnuplot distribution should contain the file ps_guide.ps. That explains all the character codes available in postscript.
In general I would second Christoph's suggestion to use a cairo terminal. In combination with UTF-8 input encoding and a proper font you can easily include more characters in your output.
When I generate plots for inclusion in TeX documents, I tend to use the same font as the body text (in the example below "TeX Gyre Pagella")
set terminal pdfcairo enhanced color dashed font "TeX Gyre Pagella, 14" \
rounded size 16 cm, 9.6 cm
set encoding utf8

Use any of the cairo-based terminal (pdfcairo or epscairo) and insert the character directly into your script:
set encoding utf8
set terminal pdfcairo font ',20'
set output 'partial-derivative.pdf'
set xlabel '∂u/∂x'
plot x

Related

GNUPLOT: Capital gamma in times new roman

I want to write the xtics font in times new roman, but one letter is the Symbol Gamma.
The code before the plot input is
reset
set encoding utf8
set xtics font "times new roman, 15"
set ylabel ("E[eV]")
set yrange[-2:2]
set xtics(" ~^J^{/Symbol=16 ^-}" 0.00000, " ~^{/Symbol G}^{/Symbol=16 ^-}" 0.66460, " ~^K^{/Symbol=16 ^-}" 1.60450, " ~^J^{/Symbol=16 ^-}" 2.26910)
The other stuff is just added because I needed a bar above each letter.
So the question is: what should I use instead of
{/Symbol G}
in order to get the Gamma in times new roman like the other letters.
I don't want to use the latex enhancement because I tried it once and the output was just ugly. So please take into account that I just want to use a *.p file.
Thank you in advance.
Make sure your terminal in in enhanced mode. You have already set the encoding properly. Make sure that your editor actually encodes your file as UTF-8!
If your times new roman actually contains the glyph for Γ (code-point 0x0393), then just insert this symbol into the gnuplot file.

How to obtain tilde or approx symbol in gnuplot legend?

I want to use either tilde (~) or approximate symbol (in latex \approx) in the legend of my gnuplot.
I am using epscairo terminal.
I tried seting either:
set encoding iso_8859_1
or
set encoding utf8
and using different commands, for example \176 as descbribed here (http://ayapin-film.sakura.ne.jp/Gnuplot/Docs/ps_guide.pdf), but nothing seems to work.
Thanks in advance! :)
It seems '\~' or "\\~" works for me for tilde. "{/Symbol \273}" produces ≈.

How to run a system command in gnuplot

I'd like to make gnuplot scripts to output *.eps files and change them into .pdf type automatically. I have a test demo which goes as:
set term postscript eps enhanced color
set output "SystemCommand.eps"
plot sin(x)
set xl "x"
set yl "y=sin(x)"
system(sprintf("epstopdf %s",SystemCommand.eps))
but it doesn't produce what I want, an error comes out every time that says:
"SystemCommand.gp", line 6: undefined variable: SystemCommand
I have tried to use SystemCommand or SystemCommand.eps, no difference here. Anyone has a suggestion?
I use Ubuntu 14.04 and bash shell.
You need to quote the filename in sprintf.
set term postscript eps enhanced color
set output "SystemCommand.eps"
plot sin(x)
set xl "x"
set yl "y=sin(x)"
system(sprintf("epstopdf %s","SystemCommand.eps"))

How do I include greek letter in gnuplot?

I'm using ubuntu 14.04 and gnuplot-x11, and found that for greek letter alpha,
{/symbol a} will work, but that just shows me {/symbol a}, not greek letter alpha.
I tried {\symbol a} or other options, but that does not work..
Using the syntax {/Symbol a} requires that you enable the enhanced mode. This can be done in several ways:
When setting the terminal
set terminal ... enhanced
After setting the terminal with
set termoption enhanced
Explicitely for a single label
set xlabel '{/Symbol a}' enhanced
Depending on the output terminal you are using, the best option is to use utf-8 encoding and directly input the characters:
set encoding utf8
set xlabel 'α'
After using enhanced mode, take care for using {/Symbol a}, you have used {/symbol a}, small letter of "s" in Symbol, so you were not getting greek letter alpha.

Gnuplot symbols in epslatex terminal with dots inside

When creating symbols in combination with the epslatex terminal in Gnuplot 4.6, I always notice that in the center of the symbol a small dot is shown (clearly visible on zoom-in). This annoys me quite a bit, as it does not happen in, for example, the png terminal of Gnuplot.
Is there a simple method in Gnuplot to get rid of this dot?
Minimum reproductive example:
set terminal epslatex
set output "test.tex"
test
It can be directly observed in the outputfile test.eps.
Additional info:
I use the following code to create a complete eps-file out of it
\documentclass{article}
\usepackage{graphics}
\usepackage{nopageno}
\usepackage{txfonts}
\usepackage[usenames]{color}
\begin{document}
\begin{center}
\input{test.tex}
\end{center}
\end{document}
Is there a solution inside gnuplot?
According to this answer: https://stackoverflow.com/a/16358393/1134387 there are much more symbols than the few shown by test in Gnuplot. When using 64, 65 and 66 as pointtype, I get symbols without the dot inside, which effectively solves my problem.
Since an other question (Removing dot from centre of empty gnuplot point) has been marked as "duplicate" with no more possibility to answer, I put my answer here to provide some test code and images.
You can do a point test sequence yourself in any terminal.
### Terminal test dots
reset session
set colorsequence classic
set terminal postscript color
# set terminal pngcairo
# set terminal pdfcairo
# set terminal qt
# set terminal wxt
set output "TestDot.eps" # in case of file output set the extension according to terminal
N = 160
M = 10
set parametric
set xrange [-0.5:M-0.5]
set yrange [-M/2:N]
set xtics 1
set ytics M
plot for [i=0:N-1] i%M,floor(i/M)*M w p pt i ps 3 notitle
unset parametric
set output
### end of code
postscript terminal:
pngcairo terminal:

Resources