Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get a dot over a symbol in gnuplot?

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

enter image description here

Second update after comments from meuh: Image 2

enter image description here

like image 919
Suganthi Selvaraj Avatar asked Jun 09 '18 23:06

Suganthi Selvaraj


1 Answers

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:

enter image description here

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 ~{}{} .

like image 101
meuh Avatar answered Nov 20 '22 21:11

meuh