mani
mani

Reputation: 155

Insertion of Greek letters in a graph legend using GNUplot

I am trying to incorporate greek symbols into my graph using following code, but keep getting similar error twice.

warning: enhanced text mode parser - ignoring spurious }

warning: enhanced text mode parser - ignoring spurious }

reset

# svg
#set terminal svg size 410,250 fname "Times New Roman" \

set terminal svg size 410,250, enhanced fname 'Times New Roman' \

fsize "12" rounded dashed
set output "data1.svg"

set tics nomirror

# color definitions
set style line 1 lc rgb "#8b1a0e" pt 1 ps 1 lt 1 lw 2 # --- red
set style line 2 lc rgb "#5e9c36" pt 2 ps 1 lt 2 lw 2 # --- green

set key bottom right

plot "abc.htm" using 1:2 title "N('\alpha', T)" w lp ls 1, \
 "abc.htm" using 1:3 title "N(\beta, T)" w lp ls 5

PS: The code was running fine until I enabled enhanced mode of svg terminal, as I needed it for inserting greek letters in my graph legends. I am using version 4.6, patch level 5. Can any one help me out?

Upvotes: 4

Views: 20567

Answers (4)

P-square
P-square

Reputation: 11

  1. choose font 'Symbol'
  2. choose corresponding English alphabet for Greek letter, eg. i have chosen 'c' for 'chi', below is the link for other characters. http://folk.uio.no/hpl/scripting/doc/gnuplot/Kawano/label-e.html

  3. fontsize can be changed easily.

eg...

set ylabel "c" font "Symbol,14"

will produce greek letter 'Chi'.

Upvotes: 1

mani
mani

Reputation: 155

I have found the way to solve this problem. The Greek letters can be inserted in SVG file using following path in the Inkscape:

Go to Text drop down menu and then click on Glyphs. Next, select font family such as Times New Roman. After that select Greek from script and all from Range options, respectively. Then Greek letters could easily be inserted in the Graph.

Upvotes: 0

Christoph
Christoph

Reputation: 48390

Use a proper encoding (UTF-8) and insert the characters directly:

reset
set encoding utf8
set terminal svg size 410,250 enhanced fname 'Times New Roman' fsize "12" rounded dashed standalone
set output "data1.svg"

set linetype 1 lc rgb "#8b1a0e" lw 2
set linetype 2 lc rgb "#5e9c36" lw 2

set key bottom right
set style function linespoints
set samples 11
plot x title "N(α, T)", 2*x title "N(β, T)"

enter image description here

Upvotes: 2

sweber
sweber

Reputation: 2986

The correct way is to

  1. use enhanced option of the terminal (you did)
  2. wite {/Symbol a} for an alpha.

Search for symbols + gnuplot on the web, you'll find lists like http://mathewpeet.org/lists/symbols/ with codes understood by gnuplot!

Upvotes: 5

Related Questions