Showing posts with label Gnuplot. Show all posts
Showing posts with label Gnuplot. Show all posts

Sunday, August 28, 2011

How to use greek symbols in a Gnuplot graphic

This is the translation into English of a previous post in Spanish.

Using the Enhanced Postscript (EPS) terminal it's possible to add a lot of symbols to a Gnuplot graphic. The syntax is very similar to the Latex one.

There's a syntax guide which includes many examples.

To create the following graphic I used the EPS terminal to label the axes with greek letters:


This is my script:
reset 
#Range
set xrange [0:3]
set yrange [-2.5:4.5]
#Range and xtic interval
set xtics -3,0.5,10
#Range and ytic interval
set ytics -2.5,0.5,4.5

#Labels with greek letters
set xlabel "t/{/Symbol p}"
set ylabel "{/Symbol q}"

#Legend position
set key
#Origin
set origin 0,0
#Ratio between heigth and width
set size ratio 0.5

#Color EPS terminal with Arial font is set as outoput terminal
set term post eps enhanced color "Arial" 11

#Graphic size
set size 1,1
#With Border
set border

#Output file
set output "theta.eps"

#Plot command
plot 'pos1.dat' using 1:2 title 'E=0.25' with lines, \
        'pos2.dat' using 1:2 title 'E=0.50' with lines, \
        'pos3.dat' using 1:2 title 'E=0.75' with lines, \
        'pos4.dat' using 1:2 title 'E=1.00' with lines, \
        'pos5.dat' using 1:2 title 'E=1.25' with lines

Thursday, February 25, 2010

Como poner letras griegas en un gráfico de Gnuplot

Usando el terminal Enhanced Postscript se pueden escribir un montón de símbolos usando una sintáxis parecida a la de Latex.

Existe una guía de dicha sintaxis en la que aparecen un montón de ejemplos.

En el siguiente gráfico utilicé la terminal EPS para poder usar letras griegas en las etiquetas de los ejes:


Este es el script que utilicé:
reset 
#Rango
set xrange [0:3]
set yrange [-2.5:4.5]
#Rango e intervalo de los xtics
set xtics -3,0.5,10
#Rango e intervalo de los ytics
set ytics -2.5,0.5,4.5

#Etiquetas de los ejes con letras griegas
set xlabel "t/{/Symbol p}"
set ylabel "{/Symbol q}"

#Se establece la posición de la leyenda
set key
#Se establece el origen
set origin 0,0
#Se establece el ratio entre el alto y el ancho del gráfico
set size ratio 0.5

#Se establece como terminal de salida un eps en color con letra Arial de tamaño 11
set term post eps enhanced color "Arial" 11

#Tamaño del gráfico
set size 1,1
#Con marco 
set border

#Fichero de salida
set output "theta.eps"

#Se plotean los datos
plot 'pos1.dat' using 1:2 title 'E=0.25' with lines, \
        'pos2.dat' using 1:2 title 'E=0.50' with lines, \
        'pos3.dat' using 1:2 title 'E=0.75' with lines, \
        'pos4.dat' using 1:2 title 'E=1.00' with lines, \
        'pos5.dat' using 1:2 title 'E=1.25' with lines
]]>

Gnuplot not so Frequently Asked Questions

Gnuplot not so Frequently Asked Questions es un sitio que contiene muchísimos trucos para mejorar la calidad de tus gráficos hechos con Gnuplot.
Me sirvió muchísimo mientras hacía la asignatura de Introducción a la Física Computacional.
-----
Gnuplot not so Frequently Asked Questions is a site that contains a lot of tips and shortcuts to improve your Gnuplot graphics.
It helped me a lot during the Introducction to Computacional Physics course.