bash 如何使用点而不是线绘制一些数据(在终端中使用 xmgrace),而不在 GUI 中明确更改它?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/5142920/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How do I plot some data (using xmgrace in the terminal) using dots, not lines, without explicitly changing it in the GUI?
提问by Stijn
i'm using xmgrace in the terminal, and want the data to be displayed directly as dots instead of lines. Achieving this in the GUI is simple, but I have to read in multiple files, and do not want to change it every time i start xmgrace. Can I add a command to the files that are read in? Or can I use an option in the terminal when I start xmgrace?
我在终端中使用 xmgrace,并希望数据直接显示为点而不是线。在 GUI 中实现这一点很简单,但我必须读取多个文件,并且不想在每次启动 xmgrace 时更改它。我可以向读入的文件添加命令吗?或者我可以在启动 xmgrace 时在终端中使用一个选项吗?
回答by feedMe
The correct way to set the appearance of a plot from the commandline is to use an existing parameter file, specified using the flag
从命令行设置绘图外观的正确方法是使用现有的参数文件,使用标志指定
-param settings.par
The parameter file can be stored beforehand, using the GUI to modify the appearance of an existing, similar plot. Modify the plot as you like, then save the appearance settings in a parameter file (convention is to use the extension .par) using Plot> Save Parameters.
可以预先存储参数文件,使用 GUI 来修改现有的相似图的外观。根据需要修改绘图,然后.par使用Plot> Save Parameters将外观设置保存在参数文件中(惯例是使用扩展名)。
A typical example command would then be
一个典型的示例命令是
xmgrace -block data2.dat -bxy 1:4 -block data2.dat -bxy 1:6 -param settings.par
In my experience, calling the
根据我的经验,调用
-param
flag last thing in your command works best.
标记命令中的最后一件事效果最好。
There really is no need to be manually text-editing your grace plot files (.agr) to achieve this.
确实没有必要手动对您的优雅绘图文件 ( .agr) 进行文本编辑来实现这一点。
回答by Seth Robertson
xmgrace has a full and complex language for expressing the configuration of the look and feel for the graph. There are two ways to go about what you described. The simple way is to load the dataset into xmgrace, change everything to make it look the way you want, then save the dataset. You will see the dataset now has tons of lines describing the configuration "@g0 on" "@ s0 linestyle 1" etc with your dataset at the end, terminated by a &.
xmgrace 有一种完整而复杂的语言来表达图形的观感配置。有两种方法可以解决您所描述的问题。简单的方法是将数据集加载到 xmgrace 中,更改所有内容以使其看起来像您想要的那样,然后保存数据集。您将看到数据集现在有很多行描述配置“@g0 on”“@ s0 linestyle 1”等,最后是您的数据集,以 & 结尾。
To replicate that graph, spit out the saved header, insert your data, and the insert the trailing &. Feed the result into xmgrace and everything will be all set up. Once you get comfortable you can start doing dynamic substitutions to rename the graph or change the symbol or whatever. See /usr/share/grace/examples for examples of what grace can do (and the config files which generate that).
要复制该图形,请吐出保存的标题,插入您的数据,然后插入尾随的 &。将结果输入到 xmgrace 中,一切都将设置完毕。一旦您适应了,您就可以开始进行动态替换以重命名图形或更改符号或其他任何内容。请参阅 /usr/share/grace/examples 以获取优雅可以做什么的示例(以及生成它的配置文件)。
The more complex method is to load the dataset, save it immediately, change it to look the way you want, and then save it again under a different name. Run diff on the two files and you will get a set of changes. You might need at most a handful of other lines from the non-changing portion, but that is somewhat rare. This produces the minimal set of fixed headers you need to prepend to the dataset. It usually isn't worth the effort to reduce the prefix size.
更复杂的方法是加载数据集,立即保存,将其更改为您想要的样子,然后以不同的名称再次保存。对这两个文件运行 diff ,您将获得一组更改。您可能最多需要一些来自不变部分的其他行,但这有点罕见。这将生成您需要添加到数据集的最小固定标头集。减少前缀大小的努力通常是不值得的。
Please remember to upvote/accept this answer if it helps you.
如果对您有帮助,请记得点赞/接受这个答案。

