如何在关键标题中包含空格字符

如何在关键标题中包含空格字符

本文介绍了Gnuplot,如何在关键标题中包含空格字符?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当从文件中读取数据时,我想为gnuplot 4.4图形使用诸如最佳F",最差F"之类的关键标题,但是我不知道如何放置空格,例如:

I want to use key titles like "Best F" "Worst F" for a gnuplot 4.4 graph, when reading the data from a file, but I can't figure out how to put the space, e.g.:

Generation Best_F Worst_F Average_F
     5        4     9         5
     4        3     9         4

我尝试在文件"Best F","Best%20F""Best \ F"中写入文件,但是当它们被读取为列标题时会被拆分,或者看起来像丑陋的%20".

I tried writing in the file "Best F", "Best%20F" "Best\ F" but they get split, when read as column headers, or I get the ugly looking "%20".

plot for[col=2:4] data.dat using 1:col title columnheader(col)

或者是否可以进行字符替换,例如"Best_F"%"->"Best F"? replace("_","\",columheader(col))?

Or is there a way to do a character substitution, like "Best_F"%" "->"Best F"? replace("_", "\ ", columheader(col))?

我正在使用终端wxt和pngcairo(无乳胶).谢谢

I am using terminals wxt and pngcairo (no latex).Thanks

推荐答案

每个手册的数据字符串"部分(这是一个旧版本,但不幸的是后来的版本尚未以HTML发行),数据文件中的字符串用双引号分隔.如果我将示例数据文件修改为这样,那么当我在gnuplot 4.6 patchlevel 1(启用了数据字符串)下运行该文件时,将获得带空格的标题.

Per the Datastrings section of the manual (that's an old version, but unfortunately later ones haven't been published in HTML), strings in data files are delimited with double quotes. If I modify your example data file to be like this, then I get titles with spaces, when I run it under gnuplot 4.6 patchlevel 1 (with datastrings enabled).

Generation "Best F" "Worst F" "Average F"
     5        4     9         5
     4        3     9         4

程序:

plot for[col=2:4] "data.txt" using 1:col title columnheader(col)

输出摘录:

这篇关于Gnuplot,如何在关键标题中包含空格字符?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!