Dani Marti venit, vidit, dixit 2006-08-28 20:28:
> Hi all,
> I'd like to plot a diagram that contains different graphs. Since the
> diagram has to help visually the reader, it is important to add symbols
> and visual guides that show the relations between the different graphs.
> A typical example would be a diagram consisting of three graphs (let's
> call them A, B, C), which correspond to the same given function for
> three different parameters. Apart from the graphs, the diagram would
> contains arrows that indicate the direction of increasing values of the
> A -> B -> C
> (the example is silly, but I hope the idea is clear).
> For me the most natural way to proceed would be to generate separately
> the three plots, without specifying their absolute position in the
> canvas, and afterwards stroke them as mere objects. It would be in this
> last step where I would specify the positions. The pseudocode would
> look like:
> A = generate_graph(parameter=0)
> B = generate_graph(parameter=1)
> C = generate_graph(parameter=2)
> Draw A at position x1 in the canvas
> Draw B at position x2 in the canvas
> Draw C at position x3 in the canvas
> Draw an arrow between A and B
> Draw an arrow between B and C
> Draw a long arrow below the row of graphs
> How would you code this in PyX?
> To not stick to this particular example (I apologize for being so
> reiterative) I am asking about how to draw a general diagram like
> but with graphs instad of boxed letters.
> I guess PyX is indeed treating graphs as objects that are eventually
> stroked in a canvas, but I don't know how to effectively do what I want.
Yes, you explained very well how to do it ;)
Confirming your guess: A graph is a canvas in the same way as the text
boxes A, B, C, D in the "connect" example are canvasses. [ OK, they are
special canvasses, but all are canvasses). So, once you've generated
your graphs A, B, C you can treat them in the same way as that example
treats the text boxes: drawing boxes and backgrounds if you like,
inserting them into another canvas, drawing connectors.
As for the positioning: graph.graphxy() accepts parameters xpos and ypos
just like the first two parameters of text.text() (or translate the