ggplot:在线图中的特定点创建X符号

时间:2017-08-24 16:31:28

标签: r ggplot2

我想在两个线图中使用X符号,其中显示0个值。

我的数据如下:

data <- read.table(text = "
Clients Throughput Systems ErrorBar
250    2494 Za     72.986
500    2491 Za     104.854
750    401  Za     130.034
1000   0    Za     0
1250   0    Za     0
250    2501 ZCT 58.987
500    2499 ZCT 89.927
750    2380 ZCT 130.475
1000   2321 ZCT 139.450
1250   2296 ZCT 142.580", header = TRUE)

绘制折线图的脚本如下:

plot1 <- ggplot(data=data , aes(x=Clients, y=Throughput, group=Systems, colour = Systems, shape=Systems)) +
  geom_errorbar(aes(ymin=Throughput-Error, ymax=Throughput+Error), width=20.5, colour="black") +
  geom_line(size=1.2) +
  geom_point(size=2.3)

plot1 <- plot1 + scale_y_continuous(breaks= seq(0,3000,500), limits = c(0,3000)) + 
  labs(x="Number of clients") +
  scale_x_continuous(breaks = c(250,500,750,1000,1250)) + 
  labs(y="Throughput (abds/sec)")

plot1 <- plot1 + scale_colour_manual(values=c("#00ff00","#0000ff"))

plot1 <- plot1 + theme_bw() + 
  theme(legend.position="bottom") + 
  labs(fill="", colour=" ", shape=" ") + 
  theme(text = element_text(size=18)) + 
  guides(fill = guide_legend(keywidth = 0.8, keyheight = 0.01))

plot1

任何帮助?

1 个答案:

答案 0 :(得分:1)

您可以使用exec $(git rev-parse --show-toplevel)/bin/pre-commit 添加X符号:

annotate

enter image description here