mirror of
https://github.com/dkogan/feedgnuplot.git
synced 2025-05-05 22:11:12 +08:00
histograms have the correct default style
This commit is contained in:
parent
167e85d2a7
commit
4f9adb6e11
@ -8,7 +8,7 @@ use Getopt::Long;
|
|||||||
use Time::HiRes qw( usleep gettimeofday tv_interval );
|
use Time::HiRes qw( usleep gettimeofday tv_interval );
|
||||||
use IO::Handle;
|
use IO::Handle;
|
||||||
use IO::Select;
|
use IO::Select;
|
||||||
use List::Util qw( first );
|
use List::Util qw( first any );
|
||||||
use Scalar::Util qw( looks_like_number );
|
use Scalar::Util qw( looks_like_number );
|
||||||
use Text::ParseWords; # for shellwords
|
use Text::ParseWords; # for shellwords
|
||||||
use Pod::Usage;
|
use Pod::Usage;
|
||||||
@ -157,6 +157,23 @@ sub interpretCommandline
|
|||||||
delete $options{with};
|
delete $options{with};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# If we're plotting histograms, then set the default histogram options for
|
||||||
|
# each histogram curve
|
||||||
|
#
|
||||||
|
# Apply this to plain (non-cumulative) histograms
|
||||||
|
if( !$options{curvestyleall} && $options{histstyle} =~ /freq|fnorm/ )
|
||||||
|
{
|
||||||
|
for my $hist_curve(@{$options{histogram}})
|
||||||
|
{
|
||||||
|
# If we don't specify any options specifically for this histogram, use
|
||||||
|
# the defaults: filled boxes with borders
|
||||||
|
if( !any { $options{curvestyle}[$_*2] eq $hist_curve } 0..(@{$options{curvestyle}}/2 - 1) )
|
||||||
|
{
|
||||||
|
push @{$options{curvestyle}}, ($hist_curve, 'with boxes fill solid border lt -1');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
# --legend and --curvestyle options are conceptually hashes, but are parsed as
|
# --legend and --curvestyle options are conceptually hashes, but are parsed as
|
||||||
# arrays in order to preserve the ordering. I parse both of these into hashes
|
# arrays in order to preserve the ordering. I parse both of these into hashes
|
||||||
# because those are useful to have later. After this I can access individual
|
# because those are useful to have later. After this I can access individual
|
||||||
@ -1497,11 +1514,11 @@ passing something like
|
|||||||
|
|
||||||
C<--histogram curveID>
|
C<--histogram curveID>
|
||||||
|
|
||||||
|
|
||||||
Set up a this specific curve to plot a histogram. The bin width is given with
|
Set up a this specific curve to plot a histogram. The bin width is given with
|
||||||
the C<--binwidth> option (assumed 1.0 if omitted). C<--histogram> does I<not>
|
the C<--binwidth> option (assumed 1.0 if omitted). If a drawing style is not
|
||||||
touch the drawing style. It is often desired to plot these with boxes, and this
|
specified for this curve (C<--curvestyle>) or all curves (C<--with>,
|
||||||
I<must> be explicitly requested by C<--with boxes>. This works with C<--domain>
|
C<--curvestyleall>) then the default histogram style is set: filled boxes with
|
||||||
|
borders. This is what the user generally wants. This works with C<--domain>
|
||||||
and/or C<--stream>, but in those cases the x-value is used I<only> to cull old
|
and/or C<--stream>, but in those cases the x-value is used I<only> to cull old
|
||||||
data because of C<--xlen> or C<--monotonic>. I.e. the x-values are I<not> drawn
|
data because of C<--xlen> or C<--monotonic>. I.e. the x-values are I<not> drawn
|
||||||
in any way. Can be passed multiple times, or passed a comma- separated list
|
in any way. Can be passed multiple times, or passed a comma- separated list
|
||||||
@ -1835,8 +1852,8 @@ in a Thinkpad.
|
|||||||
=head2 Plotting a histogram of file sizes in a directory, granular to 10MB
|
=head2 Plotting a histogram of file sizes in a directory, granular to 10MB
|
||||||
|
|
||||||
$ ls -l | awk '{print $5/1e6}' |
|
$ ls -l | awk '{print $5/1e6}' |
|
||||||
feedgnuplot --histogram 0 --with boxes
|
feedgnuplot --histogram 0
|
||||||
--binwidth 10 --set 'style fill solid'
|
--binwidth 10
|
||||||
--ymin 0 --xlabel 'File size (MB)' --ylabel Frequency
|
--ymin 0 --xlabel 'File size (MB)' --ylabel Frequency
|
||||||
|
|
||||||
=head1 ACKNOWLEDGEMENT
|
=head1 ACKNOWLEDGEMENT
|
||||||
|
Loading…
Reference in New Issue
Block a user