首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Gnuplot:如何绘制任务调度图

Gnuplot:如何绘制任务调度图
EN

Stack Overflow用户
提问于 2016-12-17 16:15:32
回答 1查看 512关注 0票数 0

我完全是个新手,我只读了一个基本教程:http://people.duke.edu/~hpgavin/gnuplot.html

我想绘制这些数据:

代码语言:javascript
复制
Processor1 t4 2 7 t3 7 12 t2 12 17
Processor2 t5 0 9 t1 10 13

由此产生的情节应该类似于这样的图像:

我在网上搜索,但我没有找到这样的情节,我发现的最相似的是堆叠的酒吧,但它们不是我所需要的。

有人知道如何使用Gnuplot来接近这个绘图程序(可能是其他绘图程序,我选择Gnuplot,因为它是一个众所周知的工具)。

@编辑1

上面的图片来自http://rtime.felk.cvut.cz/scheduling-toolbox/manual/algorithms-scheduling.php

@编辑2

我要感谢Michael O.为我的数据生成了一个绘图,即使是手动绘制它也是令人惊奇的。

实际上,我放弃了尝试用一个通用的绘图程序来绘制这个图,比如gnuplot。我开始使用matlab工具箱生成上面的图像:rtime.felk.cvut.cz/调度工具箱

用这个工具箱来绘制这个图非常简单,我将在这里写一个脚本,我用这个脚本来绘制上面提到的数据的图形。

脚本:调度Sample.m

代码语言:javascript
复制
addpath(path,'/home/carloshmm/Matlab/toolbox/TORSCHE/scheduling/');
t1 = task('t1', 3, 10, inf, inf, 1, 2);
t2 = task('t2', 5, 12, inf, inf, 1, 1);
t3 = task('t3', 5, 7, inf, inf, 1, 1);
t4 = task('t4', 5, 2, inf, inf, 1, 1);
t5 = task('t5', 9, 0, inf, inf, 1, 2);
T = [t1 t2 t3 t4 t5];
add_schedule(T, 'Task Scheduling Graphic', T.ReleaseTime, T.ProcTime, T.Processor);
plot(T);
waitforbuttonpress;

导致的阴谋:

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2016-12-17 20:44:27

这里是我试图“手动”绘制图形的尝试,也就是不直接用gnuplot读取数据,因为,我认为,这样做是不可能的。如果您想要自动绘图,我建议从某个外部程序创建gnuplot脚本,在这里您可以计算所有的位置和绘图参数。

代码语言:javascript
复制
set term pngcairo dashed size 800,400
set output 'boxes.png'
set style fill solid
unset ytics
set ytics('Processor1' 1.5,'Processor2' 0.5)
unset key
set xrange [-1:20]
set yrange [0:2]
set xlabel 't'
set object 1 rectangle from 2,1 to 7,1.7 fc rgb 'gold'
set object 2 rectangle from 7,1 to 12,1.7 fc rgb 'light-green'
set object 3 rectangle from 12,1 to 17,1.7 fc rgb 'light-blue'
set object 4 rectangle from 0,0 to 9,0.7 fc rgb 'red'
set object 5 rectangle from 10,0 to 13,0.7 fc rgb 'blue'
set arrow 1 from 2,1 to 2,1.85 filled fc rgb 'gold'
set arrow 2 from 7,1 to 7,1.85 filled fc rgb 'light-green'
set arrow 3 from 12,1 to 12,1.85 filled fc rgb 'light-blue'
set arrow 4 from 0,0 to 0,0.85 filled fc rgb 'red'
set arrow 5 from 10,0 to 10,0.85 filled fc rgb 'blue'
set label 1 't4' at 2,1.05
set label 2 't3' at 7,1.05
set label 3 't2' at 12,1.05
set label 4 't5' at 0,0.05
set label 5 't1' at 10,0.05
plot 1 w l lt 2 lc rgb 'red'

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/41200560

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档