mirror of
https://github.com/dkogan/feedgnuplot.git
synced 2025-09-18 19:18:06 +08:00
Compare commits
25 Commits
debian/1.4
...
debian/1.4
Author | SHA1 | Date | |
---|---|---|---|
![]() |
965570cf70 | ||
![]() |
ebc818791c | ||
![]() |
9cc67cdaeb | ||
![]() |
07a109b09a | ||
![]() |
7b3040ecc9 | ||
![]() |
b59137c255 | ||
![]() |
fec440c8b3 | ||
![]() |
5758865246 | ||
![]() |
6f091d1cf2 | ||
![]() |
1c853a2193 | ||
![]() |
f6c1e943ab | ||
![]() |
b8b448e256 | ||
![]() |
defcf5ef59 | ||
![]() |
ba112a3bd9 | ||
![]() |
a32370c514 | ||
![]() |
5298072894 | ||
![]() |
7d7511e62e | ||
![]() |
1744aeb6d2 | ||
![]() |
53f6cdae5b | ||
![]() |
f21797a89e | ||
![]() |
7c704dc251 | ||
![]() |
ed9512924d | ||
![]() |
2ee401fcb4 | ||
![]() |
7c1f02ec7f | ||
![]() |
5740e55a6f |
34
Changes
34
Changes
@@ -1,3 +1,33 @@
|
||||
feedgnuplot (1.45)
|
||||
|
||||
* zsh completion: --hardcopy, --image suggest filenames
|
||||
* --image now produces a nicer legend: just the filename
|
||||
* --curvestyle now overrides --curvestyleall
|
||||
- This is a bug fix
|
||||
* The version is now treated as a string not as a number
|
||||
- So "1.40" is distinct from "1.4"
|
||||
|
||||
-- Dima Kogan <dima@secretsauce.net> Sun, 29 Oct 2017 13:56:28 -0700
|
||||
|
||||
feedgnuplot (1.44)
|
||||
|
||||
* --image draws its output beneath everything else
|
||||
|
||||
-- Dima Kogan <dima@secretsauce.net> Tue, 20 Jun 2017 16:44:30 -0700
|
||||
|
||||
feedgnuplot (1.43)
|
||||
|
||||
* Added --image
|
||||
|
||||
-- Dima Kogan <dima@secretsauce.net> Mon, 19 Jun 2017 13:12:38 -0700
|
||||
|
||||
feedgnuplot (1.42)
|
||||
|
||||
* Data can now come from STDIN or files on the cmdline.
|
||||
This fixes a regression. Self-plotting data files work again
|
||||
|
||||
-- Dima Kogan <dima@secretsauce.net> Fri, 31 Mar 2017 15:38:47 -0700
|
||||
|
||||
feedgnuplot (1.41)
|
||||
|
||||
* Histograms: --xlen can coexist with --xmin/--xmax
|
||||
@@ -24,8 +54,8 @@ feedgnuplot (1.39)
|
||||
feedgnuplot (1.38)
|
||||
|
||||
* hardcopy defaults:
|
||||
- no enhanced text mode
|
||||
- larger font size
|
||||
- no enhanced text mode
|
||||
- larger font size
|
||||
|
||||
-- Dima Kogan <dima@secretsauce.net> Wed, 27 Jul 2016 22:15:11 -0700
|
||||
|
||||
|
@@ -20,9 +20,9 @@ sub parseversion
|
||||
|
||||
while(<PL>)
|
||||
{
|
||||
if( /VERSION = ([0-9\.]+)/ )
|
||||
if( /VERSION = '([0-9\.]+)'/ )
|
||||
{
|
||||
if ( $1 != $version )
|
||||
if ( $1 ne $version )
|
||||
{
|
||||
die "Version mismatch. Changes says version is '$version', but 'bin/feedgnuplot' says it is '$1'";
|
||||
}
|
||||
|
170
bin/feedgnuplot
170
bin/feedgnuplot
@@ -15,7 +15,8 @@ use Text::ParseWords; # for shellwords
|
||||
use Pod::Usage;
|
||||
use Time::Piece;
|
||||
|
||||
my $VERSION = 1.41;
|
||||
# Makefile.PL assumes this is in ''
|
||||
my $VERSION = '1.45';
|
||||
|
||||
my %options;
|
||||
interpretCommandline();
|
||||
@@ -41,17 +42,10 @@ my $last_replot_time = [gettimeofday];
|
||||
|
||||
# whether the previous replot was timer based
|
||||
my $last_replot_is_from_timer = 1;
|
||||
|
||||
|
||||
my $prev_timed_replot_time = [gettimeofday];
|
||||
my $this_replot_is_from_timer;
|
||||
my $stdin = IO::Handle->new();
|
||||
die "Couldn't open STDIN" unless $stdin->fdopen(fileno(STDIN),"r");
|
||||
my $selector = IO::Select->new( $stdin );
|
||||
|
||||
|
||||
|
||||
mainThread();
|
||||
|
||||
|
||||
|
||||
@@ -116,13 +110,13 @@ sub interpretCommandline
|
||||
'style=s{2}', 'curvestyle=s{2}', 'curvestyleall=s', 'styleall=s', 'with=s', 'extracmds=s@', 'set=s@', 'unset=s@',
|
||||
'square!', 'square_xy!', 'hardcopy=s', 'maxcurves=i', 'monotonic!', 'timefmt=s',
|
||||
'equation=s@',
|
||||
'image=s',
|
||||
'histogram=s@', 'binwidth=f', 'histstyle=s',
|
||||
'terminal=s',
|
||||
'rangesize=s{2}', 'rangesizeall=i', 'extraValuesPerPoint=i',
|
||||
'help', 'dump', 'exit', 'version',
|
||||
'geometry=s') or exit 1;
|
||||
|
||||
|
||||
# handle various cmdline-option errors
|
||||
if ( $options{help} )
|
||||
{
|
||||
@@ -427,6 +421,27 @@ sub interpretCommandline
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# deal with --image. I just fill in --equation, and reverse the y extents if
|
||||
# none are explicitly given
|
||||
if( defined $options{image} )
|
||||
{
|
||||
# images generally have the origin at the top-left instead of the
|
||||
# bottom-left, so given nothing else, I flip the y axis
|
||||
if( !defined $options{ymin} && !defined $options{ymax} &&
|
||||
! any { /^ *yrange\b/ } @{$options{set}} )
|
||||
{
|
||||
push @{$options{set}}, "yrange [:] reverse";
|
||||
}
|
||||
|
||||
if ( ! -r $options{image} )
|
||||
{
|
||||
die "Couldn't read image '$options{image}'";
|
||||
}
|
||||
|
||||
unshift @{$options{equation}}, qq{"$options{image}" binary filetype=auto flipy with rgbimage title "$options{image}"};
|
||||
delete $options{image};
|
||||
}
|
||||
}
|
||||
|
||||
sub getGnuplotVersion
|
||||
@@ -479,16 +494,66 @@ sub makeDomainNumeric
|
||||
}
|
||||
|
||||
|
||||
my $prev_timed_replot_time = [gettimeofday];
|
||||
my $pipe_in;
|
||||
my $selector;
|
||||
my $line_number = 0;
|
||||
my $is_stdin = !@ARGV; # read stdin only if no data files given on the cmdline
|
||||
sub openNextFile
|
||||
{
|
||||
my $fd;
|
||||
if($is_stdin)
|
||||
{
|
||||
$fd = IO::Handle->new();
|
||||
$fd->fdopen(fileno(STDIN), "r") or die "Couldn't open STDIN";
|
||||
}
|
||||
else
|
||||
{
|
||||
my $filename = shift @ARGV;
|
||||
$fd = IO::File->new($filename, "r") or die "Couldn't open file '$filename'";
|
||||
}
|
||||
|
||||
my $selector = IO::Select->new( $fd );
|
||||
return ($fd, $selector);
|
||||
}
|
||||
sub getNextLine
|
||||
{
|
||||
sub getline_internal
|
||||
{
|
||||
while(1)
|
||||
{
|
||||
my $line = $pipe_in->getline();
|
||||
if( !$is_stdin && !defined $line && $pipe_in->eof() && @ARGV)
|
||||
{
|
||||
# I got to the end of one file, so open the next one (which I'm
|
||||
# sure exists)
|
||||
($pipe_in, $selector) = openNextFile();
|
||||
next;
|
||||
}
|
||||
return $line;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if( !defined $pipe_in )
|
||||
{
|
||||
($pipe_in, $selector) = openNextFile();
|
||||
}
|
||||
|
||||
while(1)
|
||||
{
|
||||
$this_replot_is_from_timer = undef;
|
||||
|
||||
# if we're not streaming, or we're doing triggered-only replotting, simply
|
||||
# do a blocking read
|
||||
return $stdin->getline()
|
||||
if (! $options{stream} || $options{stream} < 0);
|
||||
if (! $options{stream} || $options{stream} < 0)
|
||||
{
|
||||
$line_number++;
|
||||
return getline_internal();
|
||||
}
|
||||
|
||||
|
||||
my $now = [gettimeofday];
|
||||
@@ -503,7 +568,8 @@ sub getNextLine
|
||||
|
||||
if ($selector->can_read($time_remaining))
|
||||
{
|
||||
return $stdin->getline();
|
||||
$line_number++;
|
||||
return getline_internal();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -654,11 +720,6 @@ sub mainThread
|
||||
print(PIPE "set xdata time\n");
|
||||
}
|
||||
|
||||
# add the extra global options
|
||||
print(PIPE "$_\n") foreach (@{$options{extracmds}});
|
||||
print(PIPE "set $_\n") foreach (@{$options{set}});
|
||||
print(PIPE "unset $_\n") foreach (@{$options{unset}});
|
||||
|
||||
# set up histograms
|
||||
$options{binwidth} ||= 1; # if no binwidth given, set it to 1
|
||||
print PIPE
|
||||
@@ -681,6 +742,11 @@ sub mainThread
|
||||
sendRangeCommand( "zrange", $options{zmin}, $options{zmax} );
|
||||
sendRangeCommand( "cbrange", $options{zmin}, $options{zmax} ) if($options{colormap});
|
||||
|
||||
# add the extra global options
|
||||
print(PIPE "$_\n") foreach (@{$options{extracmds}});
|
||||
print(PIPE "set $_\n") foreach (@{$options{set}});
|
||||
print(PIPE "unset $_\n") foreach (@{$options{unset}});
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -773,7 +839,7 @@ sub mainThread
|
||||
}
|
||||
else
|
||||
{
|
||||
$domain[0] = $.;
|
||||
$domain[0] = $line_number;
|
||||
$domain0_numeric = makeDomainNumeric( $domain[0] );
|
||||
}
|
||||
|
||||
@@ -913,7 +979,8 @@ sub updateCurveOptions
|
||||
$usingoptions = "using 1:" . join(':', @rest);
|
||||
}
|
||||
|
||||
$curve->{options} = "$histoptions $usingoptions $titleoption $curve->{extraoptions} $options{curvestyleall}";
|
||||
|
||||
$curve->{options} = "$histoptions $usingoptions $titleoption $curve->{extraoptions}";
|
||||
}
|
||||
|
||||
sub getCurve
|
||||
@@ -932,7 +999,11 @@ sub getCurve
|
||||
|
||||
if( !exists $curveIndices{$id} )
|
||||
{
|
||||
push @curves, {extraoptions => ' ',
|
||||
push @curves, {# if we have a catch-all style and no specific style, use
|
||||
# the catch-all style
|
||||
extraoptions => (!exists $options{curvestyle_hash}{$id} &&
|
||||
exists $options{curvestyleall}) ?
|
||||
"$options{curvestyleall} " : ' ',
|
||||
datastring => '',
|
||||
datastring_meta => [],
|
||||
datastring_offset => 0}; # push a curve with no data and no options
|
||||
@@ -1082,6 +1153,9 @@ sub pushPoint
|
||||
}
|
||||
|
||||
|
||||
mainThread();
|
||||
|
||||
|
||||
=head1 NAME
|
||||
|
||||
feedgnuplot - General purpose pipe-oriented plotting tool
|
||||
@@ -1683,6 +1757,17 @@ times.
|
||||
|
||||
=item
|
||||
|
||||
C<--image filename>
|
||||
|
||||
Overlays the data on top of a raster image given in C<filename>. This is passed
|
||||
through to gnuplot via C<--equation>, and is not interpreted by C<feedgnuplot>
|
||||
other than checking for existence. Usually images have their origin at the
|
||||
top-left corner, while plots have it in the bottom-left corner instead. Thus if
|
||||
the y-axis extents are not specified (C<--ymin>, C<--ymax>, C<--set 'yrange
|
||||
...'>) this option will also flip around the y axis to make the image appear
|
||||
properly. Since this option is just a passthrough to gnuplot, finer control can
|
||||
be achieved by passing in C<--equation> and C<--set yrange ...> directly.
|
||||
|
||||
C<--equation xxx>
|
||||
|
||||
Gnuplot can plot both data and symbolic equations. C<feedgnuplot> generally
|
||||
@@ -1801,16 +1886,15 @@ is possible to send the output produced this way to gnuplot directly.
|
||||
|
||||
C<--exit>
|
||||
|
||||
This controls the details of what happens when the input data is exhausted, or
|
||||
when some part of the C<feedgnuplot> pipeline is killed. This option does
|
||||
different things depending on whether C<--stream> is active, so read this
|
||||
closely.
|
||||
This controls what happens when the input data is exhausted, or when some part
|
||||
of the C<feedgnuplot> pipeline is killed. This option does different things
|
||||
depending on whether C<--stream> is active, so read this closely.
|
||||
|
||||
With interactive gnuplot terminals (qt, x11, wxt), the plot windows live in a
|
||||
separate process from the main C<gnuplot> process. It is thus possible for the
|
||||
main C<gnuplot> process to exit, while leaving the plot windows up (a caveat is
|
||||
that such decapitated windows aren't interactive). To be clear, there are 3
|
||||
possible states:
|
||||
that such decapitated windows aren't interactive). There are 3 possible states
|
||||
of the polotting pipeline:
|
||||
|
||||
=over
|
||||
|
||||
@@ -1825,35 +1909,35 @@ prompt available
|
||||
|
||||
=back
|
||||
|
||||
The C<--exit> option controls the details of this behavior. The possibilities
|
||||
are:
|
||||
The possibilities are:
|
||||
|
||||
=over
|
||||
|
||||
=item No C<--stream>, input pipe is exhausted (all data read in)
|
||||
=item No C<--stream>, all data read in
|
||||
|
||||
=over
|
||||
|
||||
=item default; no C<--exit>
|
||||
=item no C<--exit> (default)
|
||||
|
||||
Alive. Need to Ctrl-C to get back into the shell
|
||||
|
||||
=item C<--exit>
|
||||
|
||||
Half-alive. Non-interactive prompt up, and the shell accepts new commands.
|
||||
Without C<--stream> the goal is to show a plot, so a Dead state is not useful
|
||||
here.
|
||||
Without C<--stream> the goal is to show a plot, so a Dead state would not be
|
||||
useful.
|
||||
|
||||
=back
|
||||
|
||||
=item C<--stream>, input pipe is exhausted (all data read in) or the
|
||||
C<feedgnuplot> process terminated
|
||||
=item C<--stream>, all data read in or the C<feedgnuplot> process terminated
|
||||
|
||||
=over
|
||||
|
||||
=item default; no C<--exit>
|
||||
=item no C<--exit> (default)
|
||||
|
||||
Alive. Need to Ctrl-C to get back into the shell
|
||||
Alive. Need to Ctrl-C to get back into the shell. This means that when making
|
||||
live plots, the first Ctrl-C kills the data feeding process, but leaves the
|
||||
final plot up for inspection. A second Ctrl-C kills feedgnuplot as well.
|
||||
|
||||
=item C<--exit>
|
||||
|
||||
@@ -1948,11 +2032,21 @@ in a Thinkpad.
|
||||
|
||||
=head2 Plotting points on top of an existing image
|
||||
|
||||
This can be done by using C<--equation> to pass arbitrary plot input to gnuplot:
|
||||
This can be done with C<--image>:
|
||||
|
||||
$ < features_xy.data
|
||||
feedgnuplot --points --domain --image "image.png"
|
||||
|
||||
or with C<--equation>:
|
||||
|
||||
$ < features_xy.data
|
||||
feedgnuplot --points --domain
|
||||
--equation '"image.png" binary filetype=png flipy with rgbimage'
|
||||
--equation '"image.png" binary filetype=auto flipy with rgbimage'
|
||||
--set 'yrange [:] reverse'
|
||||
|
||||
The C<--image> invocation is a convenience wrapper for the C<--equation>
|
||||
version. Finer control is available with C<--equation>.
|
||||
|
||||
|
||||
Here an existing image is given to gnuplot verbatim, and data to plot on top of
|
||||
it is interpreted by feedgnuplot as usual. C<flipy> is useful here because
|
||||
|
@@ -21,6 +21,7 @@ complete -W \
|
||||
--set \
|
||||
--unset \
|
||||
--equation \
|
||||
--image \
|
||||
--geometry \
|
||||
--hardcopy \
|
||||
--help \
|
||||
|
@@ -33,9 +33,10 @@ _arguments -S
|
||||
'*--set[Additional 'set' gnuplot commands]:set-option' \
|
||||
'*--unset[Additional 'unset' gnuplot commands]:unset-option' \
|
||||
'*--equation[Raw symbolic equation]:equation' \
|
||||
'--image[Image file to render beneath the data]:image:_files -g "(#i)*.(jpg|jpeg|png|gif)"' \
|
||||
'--square[Plot data with square aspect ratio]' \
|
||||
'--square_xy[For 3D plots, set square aspect ratio for ONLY the x,y axes]' \
|
||||
'--hardcopy[Plot to a file]:filename' \
|
||||
'--hardcopy[Plot to a file]:new image filename:_files -g "(#i)*.(jpg|jpeg|png|gif)"' \
|
||||
'--maxcurves[The maximum allowed number of curves]:number of curves' \
|
||||
'(--3d)--monotonic[Resets plot if an X in the past is seen]' \
|
||||
'(--rangesizeall)--extraValuesPerPoint[How many extra values are given for each data range]:N'\
|
||||
|
32
debian/changelog
vendored
32
debian/changelog
vendored
@@ -1,3 +1,35 @@
|
||||
feedgnuplot (1.45-1) unstable; urgency=medium
|
||||
|
||||
* zsh completion: --hardcopy, --image suggest filenames
|
||||
* --image now produces a nicer legend: just the filename
|
||||
* --curvestyle now overrides --curvestyleall
|
||||
- This is a bug fix
|
||||
* The version is now treated as a string not as a number
|
||||
- So "1.40" is distinct from "1.4"
|
||||
|
||||
-- Dima Kogan <dkogan@debian.org> Sun, 29 Oct 2017 14:06:26 -0700
|
||||
|
||||
feedgnuplot (1.44-1) unstable; urgency=medium
|
||||
|
||||
* --image always goes on the FRONT of the equation list
|
||||
|
||||
-- Dima Kogan <dkogan@debian.org> Tue, 20 Jun 2017 16:45:42 -0700
|
||||
|
||||
feedgnuplot (1.43-1) unstable; urgency=medium
|
||||
|
||||
* added --image as a convenience wrapper for --equation
|
||||
|
||||
-- Dima Kogan <dkogan@debian.org> Mon, 19 Jun 2017 13:16:18 -0700
|
||||
|
||||
feedgnuplot (1.42-1) unstable; urgency=medium
|
||||
|
||||
* Upstream update:
|
||||
- Fixed regression: data can now come from STDIN or files on the
|
||||
cmdline
|
||||
- reworded manpage of --exit
|
||||
|
||||
-- Dima Kogan <dkogan@debian.org> Tue, 25 Apr 2017 11:02:18 -0700
|
||||
|
||||
feedgnuplot (1.41-1) unstable; urgency=medium
|
||||
|
||||
* Upstream update:
|
||||
|
Reference in New Issue
Block a user