小编xeo*_*eon的帖子

从gnuplot中的2个文件中获取比率

我有2个dat文件:

a.dat
#Xs
100   25
200   56
300   75
400   67


b.dat
#Xs
100   65
200   89
300   102
400   167
Run Code Online (Sandbox Code Playgroud)

我想在gnuplot中绘制一个图形,其中yy值分别是a.dat和b.dat值之间的比率.例如,25/65,56/89,75/102和67/167.

我是怎么做到的 我只知道制作一个这样的情节,而不是比例.

plot "a.dat" using 1:2 with linespoints notitle
     "b.dat" using 1:2 with linespoints notitle
Run Code Online (Sandbox Code Playgroud)

gnuplot

11
推荐指数
2
解决办法
2062
查看次数

为图例添加颜色

我创建了以下内容barplot,但问题是图例没有正确的颜色,并且网格位于条形图的前面.我想在图例的方框中放置正确的列,并将网格放在条形后面.

我还想在每个栏的底部打勾以识别它们

我怎样才能在R中执行这些功能?

barkplot

我使用的r脚本:

autos_data <- read.table("data.dat", header=T, sep="\t") 

barplot(rep(NA,length(autos_data)),ylim=c(0,max(autos_data)),axes=FALSE)
barplot(t(as.matrix(autos_data)), main=NULL, ylab= "% of Cloud usage", xlab="Input data size (MB)", ylim=c(0,50), beside=TRUE, lwd=1:2, angle=c(45,135), density=seq(5,40,10), col=c("blue","red","black","darkgreen"))
grid(NA, 5, lwd=1,lty=5, col="gray") # grid only in y-direction  

# Place the legend at the top-left corner with no frame
coords="top"
legend(coords, c("WestVirginia","Chicago I","Chicago II","California"), text.col=par("col"), cex=1.2, bty="n", xpd=TRUE, horiz=TRUE, inset=c(0,-.22), angle=c(35,135,45,135), density=seq(5,40,10),col=c("blue","red","black","darkgreen"))
Run Code Online (Sandbox Code Playgroud)

编辑:

dput(autos_data)
structure(list(WestVirginia = c(29L, 29L, 23L, 23L), ChicagoI = c(30L, 
21L, 36L, 26L), ChicagoII = c(39L, 42L, …
Run Code Online (Sandbox Code Playgroud)

r

5
推荐指数
1
解决办法
84
查看次数

标签 统计

gnuplot ×1

r ×1