如何在 ggplot one liner 中使用三个引号?
How to have three quote marks in gnuplot's oneliner?
假设你的伪代码是错误的地方两次使用引号 "
gnuplot - e "set output 'tmp.png'; set_label(x,text) = sprintf("set label '%s' at cos(%f)", text, x, x)
这是错误的。
如何在gnuplot one-liner中拥有三种类型的引号?
您必须简单地使用反斜杠转义 shell(不适用于 gnuplot!)的第二个双引号字符:
gnuplot -e "set output 'tmp.png'; set_label(x,text) = sprintf(\"set label '%s' at cos(%f)\", text, x, x)"
或者,您可以使用gnuplot的转义机制:使用双单引号转义一个单引号字符:
gnuplot -e "set output 'tmp.png'; set_label(x,text) = sprintf('set label ''%s'' at cos(%f)', text, x, x)"
假设你的伪代码是错误的地方两次使用引号 "
gnuplot - e "set output 'tmp.png'; set_label(x,text) = sprintf("set label '%s' at cos(%f)", text, x, x)
这是错误的。
如何在gnuplot one-liner中拥有三种类型的引号?
您必须简单地使用反斜杠转义 shell(不适用于 gnuplot!)的第二个双引号字符:
gnuplot -e "set output 'tmp.png'; set_label(x,text) = sprintf(\"set label '%s' at cos(%f)\", text, x, x)"
或者,您可以使用gnuplot的转义机制:使用双单引号转义一个单引号字符:
gnuplot -e "set output 'tmp.png'; set_label(x,text) = sprintf('set label ''%s'' at cos(%f)', text, x, x)"