I am looking for a way to generate a graph with multiple sets of data on the X-axis, each of which is divided into multiple sets of multiple sets. I basically want to take this graph and place similar graphs side by side with it. I am trying to graph the build a graph of the duration (Y-axis) of the same jobs (0-3) with different configurations (0-1) on multiple servers (each group with the same 8 jobs). Hopefully the following diagram will illustrate what I am trying to accomplish (smaller groupings are separated by pipes, larger groupings by double pipes):
|| 0 1 | 0 1 | 0 1 | 0 1 || 0 1 | 0 1 | 0 1 | 0 1 || 0 1 | 0 1 | 0 1 | 0 1 || || 0 | 1 | 2 | 3 || 0 | 1 | 2 | 3 || 0 | 1 | 2 | 3 || || Server 1 || Server 2 || Server 3 ||
Is this possible with either the GD::Graph Perl module or the matplotlib Python module? I can't find examples or documentation on this subject for either.
Here's some Python code that will produce what you're looking for. (The example uses 3 configurations rather than 2 to make sure the code was fairly general.)
import matplotlib.pyplot as plt
import random
nconfigs, njobs, nservers = 3, 4, 4
width = .9/(nconfigs*njobs)
job_colors = [(0,0,1), (0,1,0), (1,0,0), (1,0,1)]
def dim(color, fraction=.5):
return tuple([fraction*channel for channel in color])
plt.figure()
x = 0
for iserver in range(nservers):
for ijob in range(njobs):
for iconfig in range(nconfigs):
color = dim(job_colors[ijob], (iconfig+2.)/(nconfigs+1))
plt.bar(x, 1.+random.random(), width, color=color)
x += width
x += .1
plt.show()
This code is probably fairly transparent. The odd term (iconfig+2.)/(nconfigs+1)
is just to dim the colors for the different configurations, but keep them bright enough so the colors can be distinguished.
The output looks like: