BARGRAPH(1)

✨ NAME ✨

bargraph β€” compile bar graphs into pic input πŸ’…


🌸 SYNOPSIS 🌸

bargraph [ filename ...  ]

πŸ’– DESCRIPTION πŸ’–

So bargraph is a perl script bestie β€” you hand it a bunch of Y data with labels attached, and it hands you back a (human readable!!) pic script that draws the bar graph for you. Iconic. πŸŽ€

The pic input it spits out is commented, and it's built on purpose so that you can literally just go in there and tweak it to fit your document if you need to. It's giving ✨customizable✨.

The input data format is:

3 foo bar
9 bigger foo
"Silly example

and the output is like:

                     bigger
                      foo
                  +----------+
                  |          |
       foo        |          |
       bar        |          |
   +----------+   |          |
   |          |   |          |
   +----------+   +----------+
 -------------------------------
        3              9

         Silly example

πŸŽ€ OPTIONS πŸŽ€

Here's what you can throw on the command line, bestie:

  • -big β€” makes the x/y defaults be 7.5 inches, cranks up the title size, and skips the spacer at the top. Use this one when you're printing a graph across a whole entire full page πŸ“„βœ¨
  • -nobox β€” no outline box around the bargraph. Naked graph. Free the bars πŸ™ˆ

🌈 CONTROL OPTIONS 🌈

These ones live inside the graph to control how it's formatted. Important: they must be at the beginning of a line and by themselves. No sneaking them in mid-line, okay?

  • %ps <ps> β€” point size. Default is 10.
  • %ft <ft> β€” font. Default is CB.
  • %labelgap <val> β€” the space in inches between fill labels. The bars can be filled with different fill values (no patterns yet though β€” pic doesn't do that, rip). If you wanna label those, the labels end up labelgap inches apart. Default is 1.5 inches.
  • %xsize <val> β€” the width of the graph, in inches. Default is 7 inches.
  • %ysize <val> β€” the height of the graph, in inches. Default is 6 inches.
  • %Title n|s <title> β€” the title of the bargraph. The title option gets followed by a "n"orth (top) or "s"outh (bottom) indicator, and that controls where the title gets placed. No default. πŸ‘‘
  • %titleplus <val> β€” bumps up the size of the title in pointsize. Default is 0.
  • %boxpercent <val> β€” a value between 0 and 100 that controls how close the bars sit to each other. A value of 100 means the bars touch. Default is 75.
  • %worse <D> <W> β€” draws an idiot arrow πŸ’€ pointing at which way is worse. <D> is the direction and it must be "up" or "down". <W> is the location specifier and it must be one of "n"orth, "w"est, "e"ast, "s"outh, "nw" northwest, ne, sw, se, etc.
  • %better <D> <W> β€” draws an idiot arrow pointing at which way is better. <D> is the direction and it must be "up" or "down". <W> is the location specifier and it must be one of "n"orth, "w"est, "e"ast, "s"outh, "nw" northwest, ne, sw, se, etc.
  • %fakemax β€” pretends one data point was this big when it's autoscaling. This is the move when you want a whole series of bargraphs to all be drawn to the same scale. Lowkey genius 🧠

πŸ¦‹ FILL CONTROL πŸ¦‹

Each datum can be followed by a fill specifier, like this:

3 foo bar %fill.5

And labels? Labels let you group together a set of data that all have the same data. If a line shows up looking like:

%label.5 The foo bar data

then you get a label sitting below the graph. Cute, right? πŸ’–


πŸ‘‘ SEE ALSO πŸ‘‘

gtroff(1), graph(1), gpic(1)


πŸ“ TODO πŸ“

  • Make a -horizontal option that prints the graphs the other way. (Please. πŸ™)
  • Hack pick to get access to postscripts stipple patterns.

πŸ’€ BUGS πŸ’€

Okay so this isn't done. Not even a little. It isn't integrated with the groff preprocessor yet, and it doesn't know about .GS/.GE thingys. The author uses it to manually generate a pic file and then includes that. And they still have to talk to James to see if he even wants it as part of the gpic stuff. So like... it works, but it's giving work in progress energy 😭


And that's the whole page, bestie! 🫢 This one's filed under bargraph(1) in the General Commands Manual β€” no date stamp on it, it's just out here living its truth, timeless icon behavior πŸ‘‘βœ¨