Creating a graph with multiple sets of sets from multiple sets of data along the x-axis

I am looking for a way to generate a graph with several sets of data along the X axis, each of which is divided into several sets of many sets. I basically want to take this chart and place similar charts next to it. I am trying to plot a graph of the duration (along the Y axis) of the same tasks (0-3) with different configurations (0-1) on several servers (each group with the same 8 tasks). We hope that the following diagram illustrates what I am trying to accomplish (smaller groups are divided by pipes, larger groups are 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 the GD :: Graph Perl module or the Python matplotlib module? I can not find examples or documentation on this.

+3
source share
3 answers

Here is the Python code that will create what you are looking for. (The example uses 3 configurations, not 2, to make sure the code was pretty 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 pretty transparent. The odd term (iconfig+2.)/(nconfigs+1)is simply to reduce colors for different configurations, but to keep them bright enough so that colors can be distinguished.

:

alt text http://i28.tinypic.com/dgrnzk.png

+6

, , , , protovis

, , , , .

0

MathGL can do this easily, and it also has a Python interface. See this for an example .

0
source

Source: https://habr.com/ru/post/1714571/


All Articles