How to optimze the looks of a Gnuplot graph

The plot style for all Gnuplot exports can be customized in Options: Gnuplot settings. This is convenient to achieve uniformous style of the exported graphs e.g. for a presentation. A style-sheet can be used which can be shared within the whole work-group.

Optimize your Gnuplot Graph manually

Alternatively or additionally to the style-sheet you can customize each Gnuplot file on its own. Just open the file with a text editor of your choice and change, add or remove commands.

Collection of some useful gnuplot commands.

Semi-log plot
set logscale x
set logscale y
Change the line thickness (lw 4)
plot 'D:\bandedges.dat' linetype rgb "#FF0000" pt 5 ...
plot 'D:\bandedges.dat' linetype rgb "#FF0000" pt 5 lw 4 ...
Change font size of the x axis (20)
set xlabel "position (nm)" font "sans - serif"
set xlabel "position (nm)" font "sans - serif,20"
Use subscript and superscript (enhanced vs. noenhanced)
plot 'D:\density_hole.dat' using 1:2 title "p (10^{18} cm^{-3})"enhanced ...
plot 'D:\density_hole.dat' using 1:2 title "p (10^18 cm^-3)" noenhanced ...
Change range [xmin , xmax ] and [ymin , ymax ] of the graph
set xrange [-0.3:100.3]
set xrange [0:100]
set yrange [-1.5:2.5]
set yrange [-1.0:0.5]
Set/Remove grid
set grid
unset grid
Change thickness of the border (lw)
set border lw 2
set border lw 3
Set/Remove legend
set key on
set key off
Set/Remove box around legend (box)
set key on ... box
set key on ... nobox
Increase font size in legend
set key on ... font "sans - serif,14"
set key on ... font "sans - serif,18"
Specify the location of legend
set key left top inside ...
set key right bottom outside ...
Remove line from legend (notitle)
plot 'D:\bandedges.dat' using 1:2 title "E_c " ...
plot 'D:\bandedges.dat' using 1:2 notitle "E_c " ...
Add Greek letter to line in legend ("{/Symbol G}" enhanced)
using 1:2 title "{/Symbol G} [eV]" enhanced

produces Γ.

e, l, m, q produce ϵ, λ, μ, and θ, respectively.

Add a label to the point (x,y) in the plot
set label "label" at 0.5,1.5
Add an arrow
set arrow from 1.5,0.3 to 4,2
Graph Title
set title "title" font "sans - serif,18"

Generate high quality graphs

  1. In gnuplot window: Click on Export plot to file

  2. Save as SVG files (.svg)

  3. Open the saved .svg file with Inkscape

  4. File Export .PNG Image… Select Drawing Export