Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/67.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/sqlite/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用代表与第一个值相比的变化的R绘制一个图_R_Ggplot2_Plyr_Reshape2 - Fatal编程技术网

使用代表与第一个值相比的变化的R绘制一个图

使用代表与第一个值相比的变化的R绘制一个图,r,ggplot2,plyr,reshape2,R,Ggplot2,Plyr,Reshape2,我正在做一些程序执行速度的小测试。我有一个固定大小的表,表中填充了随机数,并通过算法进行排序。 我的测试会改变用于对此表进行排序的线程数。以下是我输出的结果示例: size;time;nb_thread;run_id 100000;0.013522;1;1 100000;0.013639;1;2 100000;0.013170;1;3 100000;0.012947;1;4 100000;0.012299;1;5 100000;0.012281;1;6 我想在图表上显示使用N个线程的改进(或不

我正在做一些程序执行速度的小测试。我有一个固定大小的表,表中填充了随机数,并通过算法进行排序。 我的测试会改变用于对此表进行排序的线程数。以下是我输出的结果示例:

size;time;nb_thread;run_id
100000;0.013522;1;1
100000;0.013639;1;2
100000;0.013170;1;3
100000;0.012947;1;4
100000;0.012299;1;5
100000;0.012281;1;6
我想在图表上显示使用N个线程的改进(或不改进)。我能够根据它们的平均值显示执行时间的变化,但结果不是直观的。你会产生错觉,认为使用两个线程而不是一个线程会有巨大的改进,但事实上,即使有改进,它也非常小

因此,我想显示只有一个线程的运行与后续运行之间的变化。
我甚至不知道我要找的东西的名字。如何执行此操作?

此图显示与第一个值相比的所有值

library(ggplot2)

ggplot(dt, aes(x = factor(run_id), y = time)) +
  geom_point(size = 3) +
  geom_hline(aes(yintercept = time[1]), color = "blue", size = 2) +
  geom_segment(aes(xend = factor(run_id), yend = time[1]),
               size = 1, color = "red", linetype = "dashed") +
  scale_x_discrete(name = "Run ID") +
  scale_y_continuous(name = "Time") +
  theme_bw() +
  theme(panel.grid = element_blank()) 

数据

dt <- read.table(text = "size;time;nb_thread;run_id
100000;0.013522;1;1
                 100000;0.013639;1;2
                 100000;0.013170;1;3
                 100000;0.012947;1;4
                 100000;0.012299;1;5
                 100000;0.012281;1;6",
                 header = TRUE, sep = ";")
dt