【发布时间】:2011-10-26 06:45:02
【问题描述】:
我有一个如下所示的数据框:
data
median min max no_of_threads
2.33 2.10 6.85 1
2.43 2.14 3.41 2
2.39 2.13 7.90 3
2.74 2.10 8.30 4
2.53 2.21 6.69 5
我制作了这个 R 函数,将 data$min 和 data$max 绘制为范围,将 data$median 绘制为线:
scalability_graph <- function(data){
h <- ggplot(data)
h <- h +
geom_ribbon(aes(x = no_of_threads, ymin = min, ymax = max)) +
geom_line(aes(x = no_of_threads, y=median, color="#CC873D")) +
scale_x_continuous("Number of threads", lim=c(0,20)) +
scale_y_continuous("Response time", lim=c(0,13)) +
opts(legend.position=c(0.20,0.90))
}
脚本产生了这个情节:
如何更改图例中的标签并将“范围”而不是顶部粗体字符串和“中位数”而不是底部标签?
【问题讨论】:
标签: r formatting plot ggplot2 legend