2

I am trying to make a gnuplot script that would produce a clone of the following output - Phonon Dispersion Relations in Insulators - by Bilz,Kress - Springer Berlin

The features I would like to incorporate are -
1. Multiplots to show transitions from one symmetry point to another - no questions
2. Latex/MathJax Labels in wxt terminal - possible?
3. Ability to switch between the two notations for symmetry points - e.g [00ζ] and Z
4. Labellings of the branches must be done by hand- inserting coordinates in the script manually.

If there are other features that seem apparent to you please comment.
For the answer to be marked correct - please answer on the best way to proceed on features 2 &3.

4

1 回答 1

1

Regarding 2: No, it is not possible to use LaTeX or MathJax for the labels in the wxt terminal. But thats only for the interactive part.

In this case, you can use utf8 and enhanced to get at least the correct symbols:

set encoding utf8
set termoption enhanced

set xlabel '[00ζ]'
set label at graph 0.5,0.5 'Σ_1(0)'
plot x

For a print-quality image, you can use set terminal cairolatex pdf to use LaTeX for the labels:

set terminal cairolatex pdf standalone
set output 'test.tex'
set bmargin 3
set xlabel '$[00\zeta]$'
set label at graph 0.5,0.5 '$\Sigma_1(0)$'
plot x
set output
system('pdflatex test.tex')

Here, you must pay attention to use single quotes ', otherwise you must escape some characters.

Regarding 3: There is no 'automatic' way to switch between the two variants, but you can of course define all labels as string, and choose between the two:

latex = 1
if (latex) {
    xlabel = '$[00\zeta]$'
    label1 = '$\Sigma_1(0)$'
} else {
    xlabel = '[00ζ]'
    label1 = 'Σ_1(0)'
}
set xlabel xlabel
set label 1 at graph 0.5,0.5 label1

In general that works, but since gnuplot doesn't know about the exact width and height of a LaTeX label, some fine-tuning of the label position might be required (e.g. with offset for the xlabel, or with different positions. In that case you can define the whole commands and call them later:

latex = 1
if (latex) {
    set_xlabel = 'set xlabel ''$[00\zeta]$'' offset 0,-1'
    set_label1 = 'set label 1 ''$\Sigma_1(0)$'' at graph 0.5,0.5'
} else {
    set_xlabel = 'set xlabel ''[00ζ]'' '
    set_label1 = 'set label 1 ''Σ_1(0)'' at graph 0.5,0.5'
}
set macros
@set_xlabel
@set_label1

Instead of using macros, you could also use eval(set_xlabel), which would allow you to define a function like:

set_label1(x,y) = sprintf('set label 1 ''$\Sigma_1(0)$'' at graph %f,%f', x, y)
eval(set_label1(0.5,0.5))
于 2013-10-22T08:14:59.137 回答