-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbargraph
More file actions
executable file
·1717 lines (1220 loc) · 52.3 KB
/
bargraph
File metadata and controls
executable file
·1717 lines (1220 loc) · 52.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#!/usr/bin/perl -w
# The interpreter line will be replaced by the Makefile to point to
# the correct version of perl.
# Use BEGIN to force the version check to happen at compile time. If
# I wait until runtime, I can get errors that really are version
# errors that appear to be something else.
BEGIN {require 5.004;}
use strict;
# bargraph
# Jeff Gibson
# Stanford University
#############################################################################
# Copyright (C) 1997, 1998, 1999 Jeff Gibson
#
# These coded instructions, statements, and computer programs contain
# unpublished proprietary information of Jeff Gibson, and are
# protected by Federal copyright law. They may freely copied, but may not
# sold without the prior, written consent of Jeff Gibson.
#############################################################################
# Do not change this line. The 'make install' will change this to use
# the libraries in the correct place.
#use lib '.';
use lib '/home/lair/jonathan/bargraphs/Bargraph-2.41';
use Bargraph;
use Getopt::Long;
use IO::File;
set_platform('UNIX');
my @OUTPUT_FORMATS = qw(ps splot gif tk);
my $DEFAULT_FORMAT = 'ps';
#############################################################################
# parse command-line
#############################################################################
my %opt;
my @options = qw(
h v quiet|q
ps splot gif tk
color!
landscape!
size=s
o=s
options=s
f=s
);
$opt{options} = '';
GetOptions(\%opt, @options) or usage();
usage() if $opt{h};
version() if $opt{v};
no_warnings() if $opt{quiet};
my $format = [grep {$opt{$_}} @OUTPUT_FORMATS]->[0];
$format = $DEFAULT_FORMAT unless defined $format;
#############################################################################
# open input and output files
#############################################################################
my $filename = shift;
my $in_fh = IO::File->new();
if(defined $filename) {
$in_fh->open($filename) or die "Can't open \"$filename\": $!\n";
} else {
$in_fh->fdopen(fileno(STDIN), 'r') or die "Can't read stdin: $!\n";
$filename = 'stdin';
}
my $out_fh = IO::File->new();
if(defined $opt{o}) {
$out_fh->open(">$opt{o}") or die "Can't open \"$opt{o}\": $!\n";
} else {
$out_fh->fdopen(fileno(STDOUT), 'w') or die "Can't write stdout: $!\n";
}
#############################################################################
# read .bargraph file if there is one
#############################################################################
my $defaults_file = $opt{f} || $ENV{BARGRAPH_DEFAULTS};
read_defaults($defaults_file);
#############################################################################
# group together all command-line options that turn into graph_options
#############################################################################
my $graph_options = construct_graph_options();
#############################################################################
# create the graph object
#############################################################################
my $graph = create_from_input($in_fh, $filename, $graph_options);
#############################################################################
# draw the graph
#############################################################################
$graph->create_image($format, $out_fh);
#############################################################################
# Close input and output files
#############################################################################
undef $in_fh;
undef $out_fh;
exit(0);
#############################################################################
# SUBROUTINES
#############################################################################
sub usage {
my $str = <<EOT
Usage: $0 [ options ] [ filename ]
Reads stdin if no filename specified
Options are:
-h This message
-v Print version information and exit
-q Quiet (no warnings)
-splot Generate splot input language
-ps Generate PostScript (default)
-gif Generate GIF
-tk Make a tk preview
-color/-nocolor allow/disallow use of colors in the graph
-landscape/-nolandscape use landscape/portrait mode
-size <m>x<n> make graph m inches by n inches
-options <string> add string to options list in graph
-o <filename> send output to named file instead of stdout
-f <filename> Read filename instead of .bargraph for defaults
EOT
;
print STDERR $str;
exit(1);
}
#############################################################################
sub version {
print STDERR "bargraph version $Bargraph::VERSION\n";
exit(0);
}
#############################################################################
sub construct_graph_options {
my $graph_options .= " $opt{options} ";
$graph_options .= boolean_option_string('landscape');
$graph_options .= boolean_option_string('color');
$graph_options .= " -size $opt{size} " if defined $opt{size};
return $graph_options;
}
#############################################################################
sub boolean_option_string {
my ($option) = @_;
return '' unless defined $opt{$option};
return $opt{$option} ? " -$option " : " -no$option ";
}
#############################################################################
#############################################################################
# Interpreter stops here. It's all documentation from here on down.
#############################################################################
__END__
=pod
=head1 NAME
bargraph - a graphing tool
=head1 SYNOPSIS
bargraph [C<-h>] [C<-v>] [C<-q>] [-ps] [-splot] [-gif] [-tk] [-color]
[-nocolor] [-landscape] [-nolandscape] [-size I<size>]
[-options I<options>] [C<-o> I<output_file>] [input_file]
=head1 DESCRIPTION
=head2 Overview
Bargraph is a bar graph generating script. It reads a .bars file
(described below). Its output depends on the command-line options,
but it is currently able to create Encapsulated PostScript, GIF, or
splot files. It can also generate a Tk window with the graph.
GIF generation is done via the GD library, which is available on CPAN.
You must have GD, version 1.18, installed in order to use GIF
generation. Newer versions of GD have removed GIF support, so they
cannot be used with bargraph. I have not yet come up with a different
way to generate GIF files, and I don't even know if I can do it in
such a way as to not be a copyright violation. My suggestion is to
generate PostScript and use other tools to do format conversion.
=head2 Command-line
=over 4
=item C<-h>
Display help message.
=item C<-v>
Print version information and exit.
=item C<-q>
Quiet mode (no warnings).
=item C<-ps>
Generate PostScript (default).
=item C<-gif>
Generate GIF.
=item C<-splot>
Generate SPLOT.
=item C<-tk>
Open Tk previewer.
=item C<-color>/C<-nocolor>
Allow/disallow use of colors in the graph.
=item C<-landscape>/C<-nolandscape>
Use landscape/portrait mode.
=item C<-size> <m>x<n>
Make graph m inches by n inches.
=item C<-options> <string>
Add string to options list in graph.
=item C<-o> <filename>
Send output to the named file instead of stdout.
=item C<-f> <filename>
Read filename instead of .bargraph as default file.
=back
=head2 Inputs and Outputs
The input file should be a .bars file (described below). It will read
stdin if no input file is specified. The output file format depends
on the options. With -ps, it generates PostScript, with -gif, it
generates a GIF file, and with -splot, it generates splot. -tk
produces no textual output, just a window with the graph. If none of
-ps, -splot, -gif, or -tk are supplied, -ps is assumed. Any generated
text is printed to stdout or to the file specified by the C<-o> option.
PostScript is the preferred back-end because it's the most flexible
(the language was designed for this sort of thing). The other
back-ends support subsets of PostScript's functionality. When a
feature isn't supported by all back-ends, it's documentation will say
so.
=head1 DATA FILE FORMAT
=head2 Bar plots
A .bars file consists of a short header with information about the
title and axis labels, followed by a list of plots and text objects.
I could write some kind of grammar for the data files, but you'd just
ignore it anyway, so I'll show the format by example. By the way, if
you're reading this as a man page, you may be a little confused since
you won't see any pictures. If you build the html documentation,
though, you'll see the pretty pictures.
=head2 ex1 Bars
Here's a very simple bargraph:
=for html
<a href='ex1.ps'>ex1.ps</a> <a href='ex1.gif'>ex1.gif</a>
# ex1.bars
# '#' is comment char
Title: My Graph: -textfont helvetica20b
XAxis: My X Axis: -labelalign center
YAxis: My Y Axis: -labelalign center
Key: right+(0.25*inch), top: Legend: -keytitlealign center
Options: -keyall -rightmargin 2
Bar: 2: First
Bar: 1: Second : -setcolor red
Bar: 3: Third : -setcolor blue
This is about the simplest bargraph that illustrates all of the major
parts. First of all, '#' is the comment character. Each command of
the .bars file is a line itself. Lines may be extended by escaping
the newline with '\'. The format of each line (with the Options: line
being the exception) is:
object_tag: [<object specific stuff>]: object_name [: <options>]
The object_tag tells what kind of object is being defined, be it the
title, the xaxis, or whatever. The following seven object tags are
special: "Title", "XAxis", "YAxis", "Key", "Colors", "Grays",
"Options". Any or all my be omitted, but any of them that are present
must appear before any other object tags.
I'm sure you can guess what the Title, XAxis, and YAxis lines do.
Don't worry about the syntax of the options yet; we'll come to that
later. The Key line is a little bit more complicated. It takes an
extra field in the format x_coord, y_coord. These coordinates of the
upper left corner of the key are expressed in the coordinate system of
the graph. Since some objects, like the key, can be difficult to
place in graph coordiates, you are free to enter expressions for each
coordiate. In reality, they can be any perl expression, but stick to
regular arithmetic to avoid funny side-effects. In addition, there
are a couple of predefined values that you can use in these
expressions. For the x coordinate, "left" is the x coordinate of the
left side of the graph, and "right" is the x coordinate of the right
side of the graph. "inch" is a conversion factor having the
dimensions of inches/x_unit. Similary, the y coordinate has the
predefined values "top", "bottom", and "inch". The Options line just
contains options that apply to the graph itself (not just an object on
the graph). Again, don't worry about option syntax now.
As you can probably figure out, a bar definition is:
Bar: y_val : name [ : options ]
The name of a bar can be any string (including nothing) that doesn't
contain \n or :. You can optionally have a third : followed by
options for the bar. The options are discussed later. Also, note
that the default color for a bar is black (the default bar color can
be changed in the .bargraph file, also discussed below).
=head2 ex2 Clusters
Now, that was nice and easy, but any number of tools make simple
bargraphs without too much trouble. This next sample file introduces
Clusters, an aggregate plot type:
=for html
<a href="ex2.ps">ex2.ps</a> <a href="ex2.gif">ex2.gif</a>
# ex2.bars
Title: Salesman Comparison
XAxis:
YAxis: Number of widgets sold
Key: right+(0.25*inch), top : Legend :
Options: -xlabel 0.25 -keyfirst -rightmargin 2
Colors: red blue black
BeginCluster: 1996
Bar: 2: Huey
Bar: 1: Dewey
Bar: 3: Louie
EndCluster
BeginCluster: 1997
Bar: 1: Huey
Bar: 3: Dewey
Bar: 2: Louie
EndCluster
Clusters are a good way to group related bars. Actually, you can have
clusters of clusters, clusters of clusters and bars, or whatever.
I'll leave that for the Examples section. I take it I don't have to
describe the cluster syntax, but I'll do it for good measure:
BeginCluster: name [ : options ]
... Bar/Cluster/StackBar/etc. definitions ...
EndCluster
Bet you couldn't figure that one out. :-) Notice that the Cluster
colored the bars (ie, no -setcolor options, and the bars weren't
black). The Cluster gets its idea of what colors to use from the
Colors: line. If we were generating a graph in black and white, it
would use a Grays: line instead. The Colors: and/or Grays: lines may
be omitted, in which case it will read these values from the .bargraph
file (described below). It defaults to some bright, gaudy colors if
you don't have a .bargraph file.
=head2 ex3 StackBars
The third plot type is the StackBar. StackBars are just like clusters
except that they can only contain bars (ie, no aggregate plots) and
thay they stack the bars on top of each other. The same data file as
above displayed using StackBars is shown below. It also introduces a
text object, just for the sake of showing you one.
=for html
<a href="ex3.ps">ex3.ps</a> <a href="ex3.gif">ex3.gif</a>
# ex3.bars
Title: Another Salesman Comparison
XAxis:
YAxis: Number of widgets sold
Key: right+(0.125*inch), top ::
Options: -xlabel 0.25 -keyfirst -rightmargin 2
BeginStackBar: 1996
Bar: 2: Huey
Bar: 1: Dewey
Bar: 3: Louie
EndStackBar
BeginStackBar: 1997
Bar: 1: Huey
Bar: 3: Dewey
Bar: 2: Louie
EndStackBar
Text: right/2,top/2: Hee, Hee: -textalign center -textangle 90
The format for a text object is
Text: x, y: text [: options]
Just like the key, the x and y coordinates are in graph coordinates.
Also like the key, expressions are allowed, as are the predefined
values "left", "right", "top", "bottom", and "inch".
One note about StackBars is that negative values are perfectly legal.
Each new positive bar in a StackBar is placed on top of the stack,
while each new negative bar is placed below the stack. The ordering
of bars with the same sign will affect the order in which the bars are
stacked, but the ordering between positive and negative bars is
irrelevant. Play with it for a minute if you're confused - it's
rather intuitive, but I don't know how to describe it very well.
There are actually two more object types, called Rect and Line. If
you want to draw either of these on the graph, use one of these
expressions:
Rect: x1, y1, x2, y2: name [: options]
Line: x1, y1, x2, y2: name [: options]
I assume you get the idea.
There's absolutely nothing to stop you from using clusters, stackbars,
etc. all on the same graph. In fact, you can have clusters of
stackbars and bars or other clusters or whatever you can dream up.
Stackbars, however, may only contian bars (not clusters, other
stackbars, etc.). If you can tell me what a stackbar of clusters
should look like, I'd be very curious.
=head2 Series plots
Well, as you can tell by the name, bargraph began life as a tool that
makes bargraphs. It has since grown into a more general plotting
tool, supporting scatter plots and line graphs. Note that bargraph
was designed to deal with relatively small data sets (you wouldn't
want a bargraph with thousands of bars, for instance), so don't be
surprised if things don't work out so well if you try to generated
scatter plots or line graphs with very large data sets. I refer to
points and line plots collectively as 'series plots' because they
share recognize the same options and have many similar properties.
=head2 ex4 Scatter Plot
The most basic series plot is a point. You can make a simple scatter
plot by just defining a bunch of points, like I do in ex4.bars.
=for html
<a href="ex4.ps">ex4.ps</a> <a href="ex4.gif">ex4.gif</a>
# ex4.bars
Title: Very Simple Scatter Plot: -textfont helvetica20b
XAxis: X Axis: -labelalign center
YAxis: Y Axis: -labelalign center
Options: -setcolor blue -setgray 0 -pointsize 10
Point: 1, 2:
Point: 2, 4:
Point: 3, 1: Important Point: -pointlabel name
Point: 5, 3:
Point: 5, 2:
Notice that I left the name of most of the points out - that just sets
the name to the empty string. The same thing is legal for any other
object definition, but I only got this lazy just now. I think you can
figure out the point definition:
Point: x, y: name [: options]
=head2 ex5 Series Scatter Plot
This is starting to get monotonous. Anyway, to group related plots,
use a Series object, which works much like a Cluster or StackBar, as
ex5.bars shows:
=for html
<a href="ex5.ps">ex5.ps</a> <a href="ex5.gif">ex5.gif</a>
# ex5.bars
Title: Rather Simple Scatter Plot: -textfont helvetica20b
XAxis: X Axis: -labelalign center
YAxis: Y Axis: -labelalign center
Key: right+(0.25*inch), top: Legend: -keytitlealign center
Options: -pointsize 10 -keyall -rightmargin 2
BeginSeries: Series1:
Point: 1, 2:
Point: 2, 4:
Point: 3, 1: Important Point: -pointlabel name
Point: 5, 3:
Point: 5, 2:
EndSeries
BeginSeries: Series2: -pointtype triangle
Point: 1, 1:
Point: 2, 3:
Point: 3, 4:
Point: 4, 2:
Point: 5, 5:
EndSeries
If you need a description of the Series syntax at this point, then you
need your head examined. The only thing interesting about this plot
is that, as you can tell, the Series are colored. If you don't supply
colors for series plots (using the soon-to-be-revealed options), they
will default to the same colors in the same order that Clusters and
StackBars use (which can be set in the Colors: line or the .bargraph file).
=head2 ex6 Line Graph
I know I said that bargraph will handle line graphs, too. Well, how
are line graphs different from scatter plots? The dots are connected.
To create a line graph you also want to use a series, but use the
correct option to tell bargraph that you want the dots connected.
Check this out:
=for html
<a href="ex6.ps">ex6.ps</a> <a href="ex6.gif">ex6.gif</a>
# ex6.bars
Title: Rather Simple Line Graph: -textfont helvetica20b
XAxis: X Axis: -labelalign center
YAxis: Y Axis: -labelalign center
Key: right+(0.25*inch), top: Legend: -keytitlealign center
Options: -pointsize 10 -keyall -rightmargin 2 -interpolation line
BeginSeries: Series1:
Point: 1, 2:
Point: 2, 4:
Point: 3, 1: Important Point: -pointlabel name
Point: 5, 3:
Point: 5, 2:
EndSeries
BeginSeries: Series2: -pointtype triangle
Point: 1, 1:
Point: 2, 3:
Point: 3, 4:
Point: 4, 2:
Point: 5, 5:
EndSeries
I don't want to go into the options here (read on if you do), but note
that the only difference between ex5.bars and ex6.bars is the
'-interpolation line' on the Options line. Hmmm. I wonder if that's
it.
=head1 OPTIONS
The .bars file is really very simple, so most of the complexity in
creating a graph is setting all of the options. Of course, they're
all optional, and the defaults usually look OK, so you should only
have to deal with options if you want to play with the appearance of
your graph.
Options are always given at the end of a line in the .bars file and
are separated from the object's name by a colon. All options start
with a dash, and all objects take one argument. Arguments are
delimted by spaces. If you want to specify an argument that contains
spaces, use a double-quoted string. You can escape a double-quotes
within a double quoted string with a '\'. If no argument is
specified, then "1" is assumed. Also, if "foo" is a valid option
name, then the option "-nofoo" will assume an argument of "0". If an
option is mutiply defined on a line, the last setting on the line will
be used.
Options don't just apply to the objects they are defined for - they
are also passed down to all contained objects. The graph contains the
axes, the title, the key, text objects defined in the .bars file, all
rects, and the top-level plots (plots that aren't contained in other
plots). An aggregate plot (cluster, stackbar, or series) contains all
plots between the Begin and End. Plots contain text objects that are
implicitly created by the "-xlabel" and "-printvalue" options
(descibed below). When an object looks for its options, it first
looks for a value given on specification line. If the option is not
defined there, it looks for its immediate container. If it can't find
the option there, it looks for that object's container, etc. If the
object is not defined anywhere, it uses a default. Because of this
arrangement, the graph-level options (the Options: line in the .bars
file) can be used as defaults for all other objects, since the graph
includes all other objects. This all sounds like a mouthful, but it's
very intuitive once you start using it. If an option doesn't work for
all back-ends (ps, tk, and splot), the option description says so.
=head2 Notes on arguments
When a color is called for, use any string from /usr/lib/X11/rgb.txt.
Case isn't important. When a gray is called for, use a value between
0 (black) and 1 (white). You can also use a color of the format
0xrrggbb, though this is supported for PostScript only. For fonts, use
helvetica<n><suffix> or timesroman<n><suffix> where <n> is a number
from 3-20 and <suffix> is either b (bold), i (italic), both, or
nothing (normal). For example, helvetica20bi is 20-point Helvetica in
bold and italics. For options that take graph coordinates, these
coordinates are relative to the origin of the graph. Options that
take no arguments are assumed to be boolean options -optionname turns
it on and -nooptionname turns it off. Note that GD (the library that
generates GIFs) does not have good-looking looking fonts, so don't
expect nice fonts in your GIFs.
=head2 Graph Options
These options are defined for the graph object. These options
normally appear on the "Options:" line in the .bars file. They may
also appear on the command line (the -options switch). In the case of
a conflict, options set on the command line override those set in the
.bars file. These options can also be set in the .bargraph file
(described below), and options in the .bargraph file can be overridden
by anything in the .bars file or the command line. Graph options can
be used as defaults for all other objects since all objects are
contained (either directly or indirectly) by the graph object.
=over 4
=item -color
Make the graph in color if 1, grayscale if zero. This can be
overridden by the command-line option. Default is 1.
=item -plotspacing I<x_dist>
Spacing between plots. The width of a bar is 1. Default is 1.
=item -leftmargin I<inches>
Distance in inches from left side of graph to the edge of the page
(not in splot). Default is 1.0.
=item -rightmargin I<inches>
Distance in inches from left side of graph to the edge of the page
(not in splot). Default is 0.5.
=item -topmargin I<inches>
Distance in inches from top of the graph to the edge of the page (not
in splot). Default is 1.0.
=item -bottommargin I<inches>
Distance in inches from top of the graph to the edge of the page (not
in splot). Default is 1.0.
=item -landscape
Generate the graph in landscape mode. This can be overridden by the
command-line option. This can lead to some ugly looking text in -gif
or -tk mode since those libraries don't permit the arbitrary rotation
of text. Caveat user. Default is 0.
=item -flipscape
Same as landsape, but flips it 180 degrees. It has the same ugly-text
problem as -landscape in -gif or -tk modes. Default is 0.
=item -size I<m>xI<n>
Makes the size of the graph (not including margins) m inches by n
inches. Defaults to 5x5. This can be overridden by the command-line
option.
=item -resolution I<dpi>
Specfies in dots per inch the resolution of the target display.
Defaults to 100 dpi. It is used to compute the size of a pixel when
specfying line thicknesses and point sizes in pixels.
=item -background I<color>
Sets the background color for the graph. If generating for splot, you
must use a splot color (see splot man page).
=item -frame
Draws a frame around the graph.
=item -framethickness I<pixels>
Sets the thickness (in pixels) if the frame.
=item framecolor I<color>
Sets the color if the frame. Use a splot color if you're generating
for splot.
=item -keyall
Add every plot to the key. This is equivalent to specifying -inkey
for every plot.
=item -keyfirst
Add the first plot specified in the .bars file to the key.
This is equivalent to specifying -inkey for the first plot.
=item -fontencoding I<encoding>
If you need any special (non-default) PostScript font encodings, you
can specify them here. Right now, the only supported encoding is
'ISOLatin1', used for non-English, European characters.
=item All options for Axis, Key, Plot, BarPlot, SeriesPlot, Text,
Line, and Rect
They don't affect the graph directly, but any of these options, when
specified to the graph, will act as global defaults.
=back
=head2 Title Options
The Title object is just a normal Text object, with the
exception that it defaults to center alignment instead of left
alignment. Specify options they way you would for any Text
object (described below).
=head2 Axis Options
The axes do a nice job of autoscalng themselves, but in case you want
to mess with them, here's your chance. You specify these options on
the XAxis: or YAxis: lines. You can give them in the global graph
options (Options: line), and they will affect both axes.
=over 4
=item -invisible
Make the axis invisible.
=item -numeric
If 1, it print the axis intervals & tics. Otherwise, don't do it.
-numeric defaults to 1 for the y-axis. It defaults to 0 for the
x-axis unless there are any Point or Series plots, in which case it
defaults to 1.
=item -position I<coord>
Set the position of where to draw the axis in the coordinates of the
other axis. The special coordinates I<min> and I<max> can be used to
indicate the minimum/maximum coordinate displayed. The default vale
of -position is I<min>.
=item -setmin I<val>
Make val the minimum axis value instead of autoscaling.
=item -setmax I<val>
Make val the maximum axis value instead of autoscaling.
=item -looseness I<fraction>
Multiply the length of the axis computed by autoscaling by
(1+fraction) to avoid having the plots run to the very edges of the
graph. Defaults to 0.15.
=item -precision I<digits>
Specify how many decimal places to use when printing interval values
on the axis. The overrides the autoscaled value.
=item -format I<format_string>
Specify a printf-style format string for printing interval values.
This overrides any precision settings. (not in splot)
=item -interval I<dist>
Distance between tics. Overrides autoscaled value.
=item -ticfont I<font>
Font to print the numeric tic labels
=item -grid
Draw lines across the graph instead of small tics.
=item -labelfont I<font>
Font for axis label.
=item -labelalign I<left|center|right>
Where on the axis to print the label. For the y axis, the
label is rotated 90 degrees, so left is down and right is up.
=item -labeldist I<inches>
How far from the axis in inches to print the label.
=item -thickness I<pixels>
Thickness of the axis in pixels.
=item -clipmin
If true, do not allow bars to draw beyond the min value of the axis
(defaults to false).
=item -clipmax
If true, do not allow bars to draw beyond the max value of the axis
(defaults to false).
=back
=head2 Key Options
If you want to make a key/legend, specify a Key: line in the .bars
file. These options can be used on that line. Note that just
specifying a Key: line will NOT add any plots to the key. You still
must specify the -inkey Plot option to any plots that you want in the
key or use the graph options -keyall or -keyfirst.
=over 4
=item -horizontal
When true, layout the key horizontally. Defaults to 0 (false).
=item -elemwidth I<inches>
Set the width in inches of the rectangles drawn for each element in
the key (default = 0.25).
=item -elemheight I<inches>
Set the height in inches of the rectangles drawn for each element in
the key (default = 0.25).
=item -elemfullwidth I<inches>
When laying out the key horizontally, it uses elemfullwidth to
control the spacing between elements. It should be >= elemwidth to
avoid overlap (default = 1.0).
=item -elemfullheight I<inches>
When laying out the key vertically, it uses elemfullheight to
control the spacing between elements. It should be >= elemwidth to
avoid overlap (default = 0.25).
=item -elemlabelpos I<top|center|bottom>
Vertically position label text on the rectangle drawn for each element
in the key. Defaults to I<center>.
=item -elemoutlinecolor I<color>
Color of the outline of the box drawn around each element. Defaults
to 'black'.
=item -elemoutlinegray I<gray>
Gray value of the outline of the box drawn around each element.
Defaults to 0.0 (black).
=item -elemoutlinethickness I<pixels>
Thickness (in pixels) of the outline around each element. Defaults to
1
=item -elemtexttab I<inches>
Space between element box and its label. Defaults to 0.125.
=item -keywidth I<inches>
How wide to make the key frame when laying out the key vertically.
=item -keyheight I<inches>
How tall to make the key frame when laying out the key horizontally.
=item -keytitlefont I<font>
Does the obvious.
=item -keytitlealign I<left|center|right>
Aligns the title in the key frame. Defaults to 'center'.
=item -keyframe
Boolean value determines whether or not a frame is drawn around the
key. Defaults to 1.
=item -keyleftmargin I<inches>
Distance from left side of key to the elements. Defaults to 0.125.
=item -keytopmargin I<inches>
Distance from top of the key to the elements. If the key has a title,
then this is the distance from the bottom of the title to the first
tlement. Defaults to 0.125.
=item -keybottommargin I<inches>
Distance from bottom of the elements to the bottom of the key when
laying out the key vertically. Defaults to 0.125.
=item -keyrightmargin I<inches>
Distance from rightmost element to the edge of the key whey laid out
in horizontal mode. Defaults to 0.125.
=item Any Rect Options
Specify how the frame is drawn.
=item Any Text Options
Specify how the labels for each element should be drawn. Note that
-textvalign options will be ignored because they are set implicitly by
-elemlabelpos.
=back
=head2 Plot Options
These options work for ALL plots: Bars, Clusters, StackBars, Points,
and Series. Container objects (Clusters, Stackbars, and Series) pass
their options down to their composite plots, which is generally what
you want.
=over 4
=item -setcolor I<color>
Set the color of the plot. This overrides whatever
default coloring scheme would have been used.
=item -setgray I<gray>