future.open has asked for the wisdom of the Perl Monks concerning the following question:

Hi Monks,

I am currently working on a piece of code where I need to plot a tree as a picture file. I am currently using GraphViz....which is perfectly fine. But its big dependency is the installation of the complete GraphViz software.

I need to remove this dependency but retain the flexibility of spreading the nodes(on the fly) of the tree(which GraphViz does so effectively) while plotting.

I have tried GD::Graph. But, because the tree is so wide and deep I can not decide the picture size/resolution at the start.

So,monks,are there other perl modules that I am missing?

Replies are listed 'Best First'.
Re: To plot a tree
by zentara (Cardinal) on Jan 30, 2009 at 20:36 UTC
    You could make a tree on a Tk::Canvas widget, then save it as postscript file, then convert to whatever, jpg, png, etc. Of course, it would take a bit of logic to lay out your tree, but you could make it as big as you want, then take the bbox of the canvas when done.

    See Data Visualization with Perl Tk.....it's not a tree, but the idea is there.


    I'm not really a human, but I play one on earth Remember How Lucky You Are
Re: To plot a tree
by MidLifeXis (Monsignor) on Jan 30, 2009 at 19:51 UTC

    Is it possible to do this in two passes? First to get your parameters, the second to actually do the plot?

    --MidLifeXis

      Yes, in fact,I get all the relations(root-->child_node) in the first pass(read), store them in a HASH,then I plot them.
Re: To plot a tree
by BrowserUk (Patriarch) on Jan 30, 2009 at 20:14 UTC
      I have stored it in a hash.($hash{root_node}=child_node)
Re: To plot a tree
by Anonymous Monk on Jan 30, 2009 at 20:22 UTC
    I wish I had a plot of trees!