Gnuplot: How to plot a task scheduling graphic

I'm a completely newbie with Gnuplot, I just read this basic tutorial: http://people.duke.edu/~hpgavin/gnuplot.html

I want to plot this data:

Processor1 t4 2 7 t3 7 12 t2 12 17
Processor2 t5 0 9 t1 10 13

And the resulting plot should be something like this image:

enter image description here

I searched through the web but I didn't find any plot like this, the most similar that I found were stacked bars, but they are not what I need.

Someone knows how to get close to this plot using Gnuplot (could be other plotting program, I choose Gnuplot because it's a well known tool for this purpose).

@edit 1

The image above is from http://rtime.felk.cvut.cz/scheduling-toolbox/manual/algorithms-scheduling.php

@edit 2

I'd like to thank Michael O. for generate a plotting for my data, even being a manual plotting it was amazing.

Actually I gave up of trying to plot this using a generic plotting program, like gnuplot. I started using the matlab toolbox that generated the image above: rtime.felk.cvut.cz/scheduling-toolbox

It was fairly simple to plot this using this toolbox, I'm going to write here the script I used to plot the graphic referring to the data above.

Script: schedulingSample.m

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;

Resulting plot:

enter image description here

Upvotes: 0

Views: 593

Answers (1)

user4489658
user4489658

Reputation:

Well, here is my attempt to plot your graph "manually", i.e. without reading your data with gnuplot directly, because, as I think, it's impossible to do so. If you want to automate plotting, I suggest to create gnuplot script from some external program, where you can calculate all positions and plot parameters.

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'

enter image description here

Upvotes: 0

Related Questions