Graphics-Skullplot

 view release on metacpan or  search on metacpan

README  view on Meta::CPAN


    Graphics::Skullplot - Plot the result of an SQL select (e.g. from an
    emacs shell window)

VERSION

    Version 0.01

SYNOPSIS

       # To use this from emacs, see scripts/skullplot.el.
       # That elisp code accesses the perl script: scripts/skullplot.pl
    
       # the code used by skullplot.pl
       my $plot_hints = { indie_count           => $indie_count,
                          dependent_requested   => $dependent_requested,
                          independent_requested => $independent_requested,
                        };
       my %gsp_args = 
         ( input_file   => $dbox_file,
           plot_hints   => $plot_hints, );
       $gsp_args{ working_area } = $working_area if $working_area;
       $gsp_args{ image_viewer } = $image_viewer if $image_viewer;
       my $gsp = Graphics::Skullplot->new( %gsp_args );
    
       $gsp->show_plot_and_exit();  # does an exec 

DESCRIPTION

    Graphics::Skullplot is a module that works with the result from a
    database select in the common tabular text "data box" format. It has
    routines to generate and display plots of the data in png format.

    Internally it uses the Table::BoxFormat module to parse the text table,
    and the Graphics::Skullplot::ClassifyColumns module to determine the
    types of the columns.

    The default image viewer is the ImageMagick "display" command.

    The immediate use for this code is to act as the back-end for the
    included Emacs package scripts/skullplot.el, so that database select
    results generated in an emacs shell window can be immediately plotted.

    This elisp code calls scripts/skullplot.pl, which might be used in
    other contexts.

METHODS

    new

      Creates a new Graphics::Skullplot object. Object attributes:

      working_area

	Scratch location where intermediate files are created. Defaults to
	"/tmp".

      image_viewer

	Defaults to 'display', the ImageMagick viewer (a dependency on
	Image::Magick ensures it's available)

    builder methods (largely for internal use)

      builder_image_viewer Currently just returns a hardcoded selection
      (the ImageMagick "display" program).

    generate_output_filenames

      Example usage:

        # relies on object settings: "input_file" and "working area"
        my $fn = 
          generate_filenames();
        my $basename = $fn->{ base };
        # full paths to file in $working_area
        my $tsv_file  = $fn->{ tsv };  
        my $png_file  = $fn->{ png };  

    plot_tsv_to_png

      Generate the r-code to plot the tsv file data as the png file. Takes
      one argument, a hash of "field metadata".

      The file names (tsv, png, plus internal formats) come from the
      "naming" object field.

      Example usages:

        $self->plot_tsv_to_png( $plot_cols ); 

    generate_png_file

      Example usage:

        $self->generate_png_file( $pc, $fn );

      Runs the given plot code (first argument) using the file-name
      metadata (second argument, defaults to object's naming), saving the
      plot as a png file ($fn->{png}).

      This generates a file of R code to run with an Rscript call. In debug
      mode, this generates a standalone unix script. ($DEBUG).

    display_png_and_exit

      Open the given png file in an image viewer Defaults to "png" field in
      object's "naming".

      This internally does an exec: it should be the last thing called.

      The image viewer can be set as the second, optional field. The
      default image viewer is ImageMagick's "display".

      Example usage:

        my $naming = $self->naming;
        my $png_file = $naming->{ png };
        $self->display_png_and_exit( $png_file );

    show_plot_and_exit



( run in 1.631 second using v1.01-cache-2.11-cpan-39bf76dae61 )