Gnuplot:禁用绘图命令的一部分 [英] Gnuplot: Disable part of a plot command

查看:49
本文介绍了Gnuplot:禁用绘图命令的一部分的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

让我们说我有以下简单的gnuplot文件:

Let us say I have following simple gnuplot file:

set term pdf
set output "test.pdf"

plot\
    sin(x),\
    cos(x),\
    0.5

现在我只想用cos(x),\临时注释该行.

Now I just want to temporarily comment the line with cos(x),\.

但是,使用注释字符#会导致错误的gnuplot命令.

However, using the comment character # results in an erroneous gnuplot command.

我正在寻找一种解决方案,而无需移动任何代码行.我只想使用编辑器的切换注释功能.

I am looking for a solution without moving lines of code. I just want to use the toggle comment feature of my editor.

推荐答案

这是一种解决方法.您可以动态地解析脚本,以完全用#删除行.使用grep:

This is a workaround. You can parse the script dynamically to remove the lines with a # altogether. Using grep:

grep -v "#" script | gnuplot

将成功解析此内容:

plot\
    sin(x),\
    #cos(x),\
    0.5

其中script是包含上面代码的文件的名称.

where script is the name of the file containing the code above.

这篇关于Gnuplot:禁用绘图命令的一部分的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆