Search code examples
gnuplotspecial-characterspostscript

Gnuplot Postscript Special Characters Math Equation


I`d like to write the math stuff into a plot using gnuplot 5:

enter image description here

I am using the terminal postscript enhanced because as far as I know this terminal is the only only capable of doing such things. I used this code:

set label 1 at 400,200 '{/Symbol=50\362@_{/=15 350}^{/=15\154}}' front

This gets me everything except the subscribed averageunder the lambda symbol. I tried everything with {,}and so on but I think I missing the part where I can escape the /SymbolStyle.


Solution

  • Many terminals support enhanced text, not only the postscript terminal.

    In order to use another font than /Symbol for the subscript you could change the font explicitely to a different one for this. However, a better approach is to change the nesting so that /Symbol affects only two parts:

    set label 1 at 0,0 '{/=50{/Symbol \362}@_{/=15 350}^{/=15{/Symbol \154}_{/=10 average}}' front
    plot x
    

    Output with gnuplot 5.0 with wxt is

    enter image description here

    If you're using the postscript terminal anyway, you could give a try to the epslatex terminal (or cairolatex):

    set terminal epslatex standalone color colortext
    set output 'equation.tex'
    set label 1 at -5,5 '$\displaystyle\int_{350}^{\lambda_{\mathrm{average}}}$'
    plot x
    
    set output
    system('latex equation.tex')
    system('dvips equation.dvi')
    system('ps2pdf equation.ps')
    

    enter image description here