Gnuplot:xtics-在tics处放置字符串

Gnuplot:xtics-在tics处放置字符串,gnuplot,Gnuplot,我是gnuplot新手,正在尝试为一个项目创建一个堆叠的直方图。我遇到的问题是,我无法将TIC标签放在x轴上(即使可以,它们的格式也不整洁)。我的gp文件如下: 以下是我的数据文件的快照: CC P1-X P1-Y P2-X P2-Y 1 0.1097586 0.3262812 1.980848 5.9098402 2 0.1010986 0.2988812 0.9966702 5.8378412 3 0.4017474 0.7559452 4.41813 11.7404132

我是gnuplot新手,正在尝试为一个项目创建一个堆叠的直方图。我遇到的问题是,我无法将TIC标签放在x轴上(即使可以,它们的格式也不整洁)。我的gp文件如下:

以下是我的数据文件的快照:

CC P1-X P1-Y P2-X P2-Y
1 0.1097586  0.3262812  1.980848  5.9098402
2 0.1010986  0.2988812  0.9966702  5.8378412
3 0.4017474  0.7559452  4.41813  11.7404132
4 0.1028442  0.2974772  1.418744  6.0554552
5 0.1097316  0.3216112  1.967492  5.8007364
6 0.954794  0.3004874  0.9568386  5.778537
这是我的gp文件:

set title "GCC compilation option by average execution time as stacked histogram"
set terminal jpeg medium
set output "histosmalldata.jpeg"
set boxwidth 0.9 absolute
set style fill solid 1.00 border -1
set key autotitle columnheader
set key outside right top vertical Left reverse enhanced autotitles columnhead nobox
set key invert samplen 4 spacing 1 width 0 height 0 
set style histogram rowstacked title  offset character 0, 0, 0
set style data histograms
set xtics border in scale 1,0.5 nomirror rotate by -45  offset character 0, 0, 0
set xtics norangelimit
set xtics ("O2-ffast-math-finline-functions" 1, "O2-funroll-loops-march=barcelona-ffast-math-finline-functions" 2, "GCCFLAGS_O0" 3, "O2-ftree-vectorize-funroll-loops-march=barcelona" 4, "GCCFLAGS_O2" 5, "O2-ftree-vectorize-funroll-loops-ffast-math" 6)
set xtics 1,6 nomirror 
set ytics 0,100 nomirror
set ytics 1
set yrange [0:20]
set ylabel "Time"
set xlabel "GCC Compiler Options"
plot 'smalldata' using 2:xtic(1) ti col, '' using 3 ti col, '' using 4 ti col, '' using 5 ti col
这是图表的图像:

现在,在x轴上,我有1,2,3-6,我不想要,相反,我想要1的“O2ffast数学finline函数”,等等,以一种整洁的格式

我在查阅了gnuplot页面上的一些示例后编写了这个脚本,对其中的一些动词没有很好的理解,因此除了解决方案之外,欢迎发表一般性评论

谢谢你,

Sayan

在指定所需内容后,不应覆盖
xtics
设置

将所有选项放入一个
set
命令:

set xtics border in scale 1,0.5 nomirror rotate by -45  offset character 0, 0, 0\
         norangelimit\
         ("O2-ffast-math-finline-functions" 1,\
          "O2-funroll-loops-march=barcelona-ffast-math-finline-functions" 2,\
          "GCCFLAGS_O0" 3, "O2-ftree-vectorize-funroll-loops-march=barcelona" 4,\
          "GCCFLAGS_O2" 5, "O2-ftree-vectorize-funroll-loops-ffast-math" 6)

请注意,可以使用反斜杠作为换行符的最后一个字符来转义换行符。

我发现,我实际上不需要指定ticlabels,因为这些信息在我的源文件中。 因此,我修改了源文件,如下所示:

set title "GCC compilation option by average execution time as stacked histogram"
set terminal png size 1500,1200 font "/Library/Fonts/Times New Roman Bold.ttf, 13"
set output 'hist_gcc_1.png'
set boxwidth 0.9 absolute
set style fill solid 1.00 border -1
set key outside right top vertical Left reverse enhanced autotitles columnhead nobox
set key invert samplen 4 spacing 1 width 0 height 0 
set style histogram rowstacked title offset character 0, 0, 0
set datafile missing '-' 
set style data histograms
set xtics border in scale 1,0.5 nomirror rotate by -45 offset character 0, 0, 0     norangelimit
set ytics 0,100 nomirror
set ytics 1
set yrange [0:20]
set ylabel "Time"
set xlabel "GCC Compiler Options"
plot 'data' using 2:xticlabels(1) ti col, '' using 3 ti col, '' using 4 ti col, '' using 5 ti col
我的dat文件如下所示:

CC P1-X P1-Y P2-X P2-Y
O2-ffast-math-finline-functions 0.1097586  0.3262812  1.980848 5.9098402
O2-funroll-loops-march=barcelona-ffast-math-finline-functions 0.1010986 0.2988812  0.9966702 5.8378412
GCCFLAGS_O0 0.4017474 0.7559452 4.41813 11.7404132
...

谢谢,但即使在组合了所有xtics语句之后,图形仍然几乎相同,只是在我尝试运行脚本时出现了一个例外:第22行:警告:难以为xtic标签腾出空间。。。。有什么想法吗?