Graph gnuplot将多个条分组

Graph gnuplot将多个条分组,graph,plot,gnuplot,Graph,Plot,Gnuplot,我正在使用gnuplot为多个基准生成图形。 对于每个基准,我有许多配置要绘制。 我想绘制一个命中率(y轴)与基准(x轴)的图表。 每个基准将有多个列,按颜色区分 不久前,我使用一些python脚本生成了相同类型的图形,但我不知道如何在gnuplot中实现这一点。这是原始数据,语言。数据: Title C C++ Java Python "Writing code" 6 4 10 1 "Understanding code" 6 3 4 1 "Gene

我正在使用gnuplot为多个基准生成图形。
对于每个基准,我有许多配置要绘制。 我想绘制一个命中率(y轴)与基准(x轴)的图表。 每个基准将有多个列,按颜色区分


不久前,我使用一些python脚本生成了相同类型的图形,但我不知道如何在gnuplot中实现这一点。

这是原始数据,
语言。数据

Title   C   C++ Java    Python
"Writing code"  6   4   10  1
"Understanding code"    6   3   4   1
"Generating prime numbers"  3   1   2   10
使用此代码:

set title "Benchmarks"
C = "#99ffff"; Cpp = "#4671d5"; Java = "#ff0000"; Python = "#f36e00"
set auto x
set yrange [0:10]
set style data histogram
set style histogram cluster gap 1
set style fill solid border -1
set boxwidth 0.9
set xtic scale 0
# 2, 3, 4, 5 are the indexes of the columns; 'fc' stands for 'fillcolor'
plot 'languages.data' using 2:xtic(1) ti col fc rgb C, '' u 3 ti col fc rgb Cpp, '' u 4 ti col fc rgb Java, '' u 5 ti col fc rgb Python
提供以下直方图:

但我建议使用哪种语法更具可读性:

library(ggplot2)
# header = TRUE ignores the first line, check.names = FALSE allows '+' in 'C++'
benchmark <- read.table("../Desktop/gnuplot/histogram.dat", header = TRUE, row.names = "Title", check.names = FALSE)
# 't()' is matrix tranposition, 'beside = TRUE' separates the benchmarks, 'heat' provides nice colors
barplot(t(as.matrix(benchmark)), beside = TRUE, col = heat.colors(4))
# 'cex' stands for 'character expansion', 'bty' for 'box type' (we don't want borders)
legend("topleft", names(benchmark), cex = 0.9, bty = "n", fill = heat.colors(4))
库(ggplot2)
#header=TRUE忽略第一行,check.names=FALSE允许在“C++”中使用“+”

我们可以看看你的数据样本吗?在您的数据文件中,基准是按数字还是按名称列出的?嘿,gnu脚本工作了。谢谢title col命令是什么意思?我不知道:D显然,它代表
title columnhead
,并显示行的第一项。