[Graph-dev] bugfix/change request for Chart-Graph-3.2's Chart/Graph/Gnuplot.pm
Ketan Desai
ketan at rentec.com
Fri Jan 19 10:36:14 PST 2007
Hi Emile,
If the "output type" has a valid known value, then unconditionally a "set terminal FOO" type command
is conveyed to gnuplot . This happens after extra_opts are processed so it
overrides the "set terminal x11" in my "extra opts".
The only way I can see out of this is either to allow "output type" to be undefined (as before)
or to define a new 'valid' "output type" which has different actions.
Perhaps an output type of "x11" which would "set terminal x11" ?
I didn't think that was a good choice as other people may want to set a different device...
I still need to invoke gnuplot itself with -persist otherwise the plot disappears immediately after
it is painted.
thanks,
-K
Emile Aben wrote:
> Hi Ketan,
>
> The functionality you want added is the ability to output to screen instead of to a file. Chart-Graph-3.2 has the ability to output to standard output instead of to file; you'll have to set the 'output file' option to undef.
>
> I'll discuss with others on the team if we'd want to extend the scope of Chart::Graph::Gnuplot to support persistant gnuplot processes and how we'd want to do that.
>
> best regards, Emile Aben Data Administrator CAIDA/SDSC/UCSD
>
> On Fri, Jan 19, 2007 at 10:03:30AM -0500, Ketan Desai wrote:
>> Hi, We recently upgraded our installation of Chart-Graph-3.2 and I ran into some problems. I generally invoke this perl module inside a Perl/Tk application where the user expects to see a plot on the screen (I use the gnuplot x11 device).
>>
>> I tracked my problems down and have two changes to request.
>>
>> 1) gnuplot used to be invoked with a '-persist' flag. The latest module seems to have just removed that flag.
>
> I didn't find any reference to the -persist flag in our current CVS repository, so I don't think this has ever been a part of Chart-Graph.
I guess someone here had added that flag as a local patch without feeding it back to you guys.
>
>> I would like to add a switch to allow the user to request that form of invocation.
>>
>> 2) The "output type" option previously could be set to 'undefined' . This is necessary if one does not want to write to a file. (I chose not to hack an output type of 'x11' because presumably there are other graphical devices besides x11 that one might choose to use.)
>>
>> I would like to add this functionality back in.
>>
>> Below I show the diff of my version of Chart/Graph/Gnuplot.pm and our installed version (which came from Chart-Graph-3.2).
>>
>> Thanks for all your efforts, this module is very useful.
>>
>> -K
>>
>>
>> *** <loc>/Chart/Graph/Gnuplot.pm 2007-01-10 12:09:40.723747000 -0500 --- /usr/local/products/perl/5.8.8/lib/site_perl/5.8.8/Chart/Graph/Gnuplot.pm 2006-06-07 17:09:33.000000000 -0400 *************** *** 63,69 **** # these variables hold default options for gnuplot my %def_gnu_global_opts = ( "title" => "untitled", - "persist" => 0, "output type" => "png", "output file" => "untitled-gnuplot.png", "x-axis label" => "x-axis", --- 63,68 ---- *************** ***
>> 116,122 **** sub gnuplot { my ($user_global_opts_ref, @data_sets) = @_; my (%data_opts, %global_opts,); ! my ($plottype, $output_file, $plot_file, $output_type, $data_set_ref, $qPersist); # create a new filehandle to be used throughout package my $handle = new FileHandle;
>>
>> --- 115,121 ---- sub gnuplot { my ($user_global_opts_ref, @data_sets) = @_; my (%data_opts, %global_opts,); ! my ($plottype, $output_file, $plot_file, $output_type, $data_set_ref); # create a new filehandle to be used throughout package my $handle = new FileHandle;
>>
>> *************** *** 358,364 **** $output_file = $value; }
>>
>> ! if ($key eq "output type" and defined $value) { if (!($value =~ /^(pbm|gif|tgif|png|svg|eps(:? .*)?)$/)) { carp "invalid output type: $value"; $handle->close(); --- 357,363 ---- $output_file = $value; }
>>
>> ! if ($key eq "output type") { if (!($value =~ /^(pbm|gif|tgif|png|svg|eps(:? .*)?)$/)) { carp "invalid output type: $value"; $handle->close(); *************** *** 367,376 **** } $output_type = $value; } - - if ($key eq 'persist') { - $qPersist = 1; - } }
>>
>> # create the data file --- 366,371 ---- *************** *** 441,447 **** $handle->close();
>>
>> # gnuplot and convert pbm file to gif ! if (not _exec_gnuplot($command_file, $qPersist)) { _cleanup_tmpdir(); return 0; } --- 436,442 ---- $handle->close();
>>
>> # gnuplot and convert pbm file to gif ! if (not _exec_gnuplot($command_file)) { _cleanup_tmpdir(); return 0; } *************** *** 765,772 **** #
>>
>> sub _exec_gnuplot { ! my ($command_file, $qPersist) = @_; ! my $status = system("$gnuplot", ($qPersist ? '-persist' : ()), "$command_file");
>>
>> if (not _chk_status($status)) { return 0; --- 760,767 ---- #
>>
>> sub _exec_gnuplot { ! my ($command_file) = @_; ! my $status = system("$gnuplot", "$command_file");
>>
>> if (not _chk_status($status)) { return 0; *************** *** 1047,1053 **** | | 'svg' or "eps $epsoptions"| | |'output file' | set your own output file, | 'untitled-gnuplot.png' | | | undef to output to STDOUT | | - |'persist' | 0 or 1 | 0 | |'x-axis label' | set your own label | 'x-axis' | |'y-axis label' |
>> set your own label | 'y-axis' | |'x2-axis label' | set your own label | none | --- 1042,1047 ---- *************** *** 1126,1135 ****
>>
>> Finally, data can be stored in a file.
>>
>> - If the plot is to be displayed on a terminal, the "persist" option - should be used so that I<Gnuplot> will be invoked with "-persist". - The resultant plot window will persist until the user exits it. - =head2 USING GNUPLOT TO READ AND PLOT DATE/TIME DATA DIRECTLY
>>
>> I<Gnuplot> now has the capability to read date/time data and to create --- 1120,1125 ----
>>
>>
>> _______________________________________________ Graph-dev mailing list Graph-dev at caida.org https://rommie.caida.org/mailman/listinfo/graph-dev
>
More information about the Graph-dev
mailing list