I am trying to create a plot in gnuplot with dots over the symbol theta in legend.
I am looking to do something similar to, \dot{\theta} and \ddot{\theta} from latex. However, most posts ask to use 'set term latex' or 'set term epslatex' which outputs a .tex file. I need to keep the output as a pdf with the dot and double dot over the theta in the legend. Is this possible? Appreciate any help. Thanks!
In place of 'Pitch rate', I need the symbol theta with a dot above it. In place of 'Pitch acceleration', I need the symbol theta with two dots above it.
set term pdf
set termopt enhanced
set encoding utf8
set output "rampfuncs.pdf"
set style func linespoints
set xlabel 'time'
set format y "%.2f"
plot "output.dat" using 1:2 title '{/Symbol q} - Pitch angle', \
"output.dat" using 1:3 title 'Pitch rate', \
"output.dat" using 1:4 title 'Pitch acceleration'
set term x11
Update after answer from meuh: Image for reference
Second update after comments from meuh: Image 2
This is described in the section Enhanced text mode of the gnuplot guide. You can use the ~
tilde character to overprint two items, for example ~a/
will overprint a
and /
. In your case you need to raise the dot character by 1.1 times the font size (found empirically) in order for it to appear above the a
so you prefix the character with this number, and enclose it in braces to make it one item: ~a{1.1.}
plot "data" using 1:2 title '{/Symbol q} angle', \
"data" using 1:3 title '~{/Symbol q}{1.1.} rate', \
"data" using 1:4 title '~{/Symbol q}{1.1..} accel'
which gives this result:
There seems to be a bug where the title will not be shown correctly if the ~{}{}
construct is at the end of the title. The simple workaround is to add an extra space at the end of the title ~{}{}
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With