mathfontsgnuplot

Gnuplot `title` using `set` and `show` versus as a follow on to `plot` on polar coordinates


I am using gnuplot 6.0 patchlevel 3 on Manjaro Linux, with the MWE below

reset
set encoding utf8
set terminal pdfcairo size 8in,8in font "STIX Two Math, 24" enhanced
set output "mwe-SO.pdf"
set polar
set angles radians
set grid linetype 3 linecolor "gray80"
set border linewidth 0.5
set samples 1000
set trange [0:10*pi]
set border linewidth 0.5
plot 1.0 * exp(0.1 * t) lw 5 title "Logarithmic Spiral 𝑟 = 𝑎𝑒^{𝑘θ}"
# set title "Logarithmic Spiral 𝑟 = 𝑎𝑒^{𝑘θ}" font "STIX Two Math, 24" enhanced
# show title

With the MWE as is, I get a title on the top right with math elements using the right fonts. enter image description here

However, if I un-comment the last two lines and comment out the segment from title onward on the third last line, I get the values for a, r and k instead of their symbols and the math font is lost.

enter image description here

My four questions are:

  1. How do I specify the location of the title with polar coordinates in the set title line?

  2. How may I get the symbols instead of the values if I use set title?

  3. How may I get the math font if I use set title?

  4. Fallback option: If I comment out the last two lines and restore the title portion of the thrd last line, how may I position it where I want?

Thanks.

P.S. The STIX two fonts are available on most Linux systems or from the GitHub repo.


Solution

  • This is an answer, but also asking for clarification. I guess you might be confused about different titles. Actually, there are at least 3 titles:

    By the way, settings or changes after the plot command will not appear in the plot. The plot command is usually the last command.

    Check the following example and let us know which title you are actually talking about.

    Script:

    ### different titles
    reset session
    
    set title "Graph title" font "STIX Two Math,20"
    
    set key out title "Legend/key title" font "STIX Two Math,14"
    
    plot sin(x)/x       title "first keyentry title", \
         sin(2*x)/(2*x) title "second keyentry title" 
    
    ### end of script
    

    Result:

    enter image description here

    Well, let me try to answer your four questions:

    1. check help title and help coordinates
    set title "Logarithmic Spiral 𝑟 = 𝑎𝑒^{𝑘θ}" at polar pi/3, polar 0.5
    
    1. as long as your set title is after the plot command, it has no effect

    2. see 2.

    3. this is the keyentry title (check help key), i.e. a title together with the line (or point symbol) of the curve. If you have only one curve in your graph, it should be clear what you mean. So, instead of a keyentry title you could write it into the graph title. Anyway, you can position the key via the same coordinates like all labels.

    Actually, titles are nothing else than special labels. In the example below, I added a set of labels at specific positions in the polar plot. I hope all this will answer your questions.

    Script:

    ### titles/labels in polar coordinates
    reset session
    
    set polar
    set size ratio -1
    set border 0 polar
    set grid polar lt -1 lc "dark-grey"
    unset tics
    set ttics 30
    set rtics
    set samples 1000
    set trange[0:10*pi]
    
    set title "Logarithmic Spiral 𝑟 = 𝑎𝑒^{𝑘θ}" font "STIX Two Math,20" at polar pi/3, polar 0.5
    
    set for [i=1:12] label i sprintf("%d",i) at polar 7*pi/12-pi*i/6, polar 23 tc "blue"
    
    set key at polar pi/2+0.2, polar 19 center font "STIX Two Math,12"
    
    plot 1.0*exp(0.1*t) lc "red" lw 2 title "Logarithmic Spiral 𝑟 = 𝑎𝑒^{𝑘θ}"
    ### end of script
    

    Result:

    enter image description here