Friday, March 16, 2012

The diffrence among various forms of quotation marks

There are three different forms of quotation marks in gnuplot. They are single quote, double quote and backquote.

The main difference between sing and double quote marks is whether backslash processing of special characters can be used. In double quote the backslash pattern is effective, so if you type in the following command
print "The first line.\nThe second line."
Then it will comes out to be
The first line.
The second line.
While if you type in the command like this:
print 'The first line.\nThe second line.'
Then the out coming string will be
The first line.\nThe second line.

The back quotes have a absolutely different utility. It is used to enclose system commands for substitution into the command lines. (Note that this utility is not supported on all platforms.) For example in a Linux platform you can add a watermark to your graph like this:

set label "By gnuplot-surprising at `date +%Y-%m-%d`" center\
    at screen 0.5,0.5 tc rgb"#cccccc"
plot sin(x)

The watermarked picture looks like this
Back quotes in gnuplot --- substitution

2 comments:

Creative Commons License
Except as otherwise noted, the content of this page is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.