#1313 syntax error when notitle is followed by a function

5.0
closed-fixed
nobody
None
5
2014-02-25
2013-12-23
Markus Appel
No

I tried switching off some titles by substituting the command 'title' with 'notitle', but this seems to fail when the title is generated by a function:

mytitle(n) = 'my test title nr '.n
plot x title mytitle(1)

plot x notitle mytitle(1)

On Ubuntu 12.04, gnuplot 4.6.4 says to the 2nd plot command

';' expected

and cvs head

unexpected or unrecognized token

When 'mytitle' is a simple string constant, there is no problem.

Discussion

  • Ethan Merritt
    Ethan Merritt
    2013-12-30

    Now fixed (I think) in 4.7

    It turns out to be harder than expected to fix this because the "function" may not really be a function call at all. Consider this line from the demo script iterate.dem:
    plot for [n=2:10] sin(x*n)/n notitle lw (13-n)/2
    If we tell the program that a function is legal following notitle but should be ignored, then it mistakes lw(...) for a function. At that point it either complains that lw has not been defined or consumes and then ignores it, neither of which is the desired outcome.

     
  • Ethan Merritt
    Ethan Merritt
    2014-01-03

    • status: open --> pending-fixed
     
  • Markus Appel
    Markus Appel
    2014-01-07

    Thanks, my original problem is solved in 4.7

    However, the issue you mentioned is actually unexpectedly problematic, I agree ... and it seems not to be solved definitely. If I use the demo line you mentioned now in 4.7:

    plot for [n=2:10] sin(x*n)/n notitle lw (13-n)/2

    I get the nice plot. When I define

    lw(x) = 1

    I get the same plot incl. the proper linewidths, but when I type

    lw(x) = 'test'

    the subsequent plot command complains with

    "Non-numeric string found where a numeric expression was expected"

    .

    help strings says:

    "In general, elements on the command line will only be evaluated as possible string variables if they are not otherwise recognizable as part of the normal gnuplot syntax."

    Maybe it makes sense to apply this rule to functions as well? I.e., elements on the command line are evaluated as possible (user defined) functions only if they are not recognizable gnuplot syntax?

     
  • Ethan Merritt
    Ethan Merritt
    2014-02-25

    • status: pending-fixed --> closed-fixed
     
  • Ethan Merritt
    Ethan Merritt
    2014-02-25

    That would be nice, but I'm afraid the syntax is too open-ended for that to be an easy task.