Gnuplot symbols in epslatex terminal with dots inside - gnuplot

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:

Related

Spurious '-' text with epslatex and multiplot

The following gnuplot snippet generates a multiplot showing six plots of data ported via stdin, but the special filename '-' used is also printed on the output:
set term epslatex color
set output 'mwe.tex'
set multiplot layout 3,2 scale 1,1 columnsfirst
set xrange [-3.1415:3.1415]
set yrange[-1.0:1.0]
set cbrange [-1:1]
set size ratio -1.0
set palette rgb 33,13,10
unset colorbox
plot '-' with image
-3.1416 -1.00 0.00
-3.1089 -1.00 0.00
(...)
e
(...)
unset multiplot
(The 'plot' command and what follows until and including 'e' is repeated six times with different input before the unset multiplot command.)
The output is shown here. The special filename '-' must be included in the plot command to plot inline data, but it should not be shown in the resulting plot. How to avoid this behavior?
The problem persists when using the 'standalone' term option with epslatex, but it does not show up when using other terminals.
I use gnuplot 4.6 patch 2.
According to the StackOverflow rule "no answer in the comments", here again as answer. Also check help key and the options there.
Try:
set key noautotitle
or
plot '-' with image notitle

Gnuplot script to output eps or svg - how to write?

I have the following gnuplot script:
set autoscale
unset log
unset label
set xtic auto
set ytic auto
unset title
set xlabel "Number of clusters"
set ylabel "Accuracy of classifier (%)"
plot "cluster.dat" using 1:3 title "PART" with lines, \
"cluster.dat" using 1:4 title "JRip" with lines, \
"cluster.dat" using 1:5 title "FURIA" with lines
I would like this script, when run, to output SVG or EPS - what would I need to add or modify to make this happen?
In gnuplot the output type is called terminal.
In your script, before the plot command use
set term svg
set output "output.svg"
or
set term eps
set output "output.eps"
both terminals have several options. Type help eps (on some gnuplot this is help epscairo) or help svg.
To get the list of available terminals for your build, type set terminal.

Symbols in 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

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

Gnuplot - Using replot with png terminal

I am trying to use replot with png terminal in Gnuplot.
If I do the following I get two plots on one graph without any problem:
plot sin(x)/x
replot sin(x)
Now if do the same for a png terminal type the resulting png file only contains the first plot.
set terminal png
set output 'file.png'
plot sin(x)/x
replot sin(x)
Am I missing something at the end to get the second plot in my png file?
This is actually a very good question, and the behavior here is terminal dependent. Some terminals (e.g. postscript) will give you a new page for each replot. You have a couple of solutions...
First Option: You can make your plot prior to setting the terminal/output and then replot again after you set the terminal/output:
plot sin(x)/x
replot sin(x)
set terminal png
set output 'file.png
replot
This option is sometimes convenient if you want to plot the same thing in multiple terminals, but I rarely use it for anything else.
Second (better) Option: You can pack multiple plots into one command separating each with a comma.
set terminal png
set output 'file.png'
plot sin(x)/x, sin(x)
I very much prefer the second way -- when in a multiplot environment, this is the only way to put multiple graphs on the same plot. If you have very long functions to plot, you can break the line with gnuplot's line continuation (\ at the end of the line -- Nothing is allowed after the \, not even whitespace)
plot sin(x)/x with lines linecolor rgb "blue" linetype 7 lineweight 4, \
sin(x), \
cos(x)

Resources