Making Beautiful Graphs with Zplot

Remzi H. Arpaci-Dusseau University of Wisconsin, Madison

In this paper, I introduce Zplot, an open-source and (soon to be) freely available Tcl library for making twodimensional data plots in postscript. Zplot provides a simple set of primitives that allow users to input and manipulate data, plot said data in a variety of formats, and decorate the resulting graphs with axes, labels, and other textual accents. Zplot then outputs encapsulated postscript for ease of inclusion in technical documents.

1 Introduction

Over the past 20 years or so, I have used a variety of tools to generate data graphics for the various technical papers with which I have been involved. These tools left me despondent. They seemed incapable of producing all but the most basic of graphs. Many common graph types were not well supported. Simple data manipulations were forced into pre-processing steps, creating a clumsy tool chain. Manual manipulation of the resultant postscript was often required to achieve the desired result. Zplot is the fruit that was born of this frustration. Zplot is a pure open-source Tcl library that enables the creation of two-dimensional data graphics in a flexible and powerful manner. Typical graphs are created with only a few lines of Tcl, and complex and intricate graphs can be produced from only tens of lines of code. In this document, I give a brief description of Zplot. First, I present an overview of the tool and the basic primitives it provides. Then, I briefly sketch the basic routines in more detail, showing how they can be combined to produce a wide range of interesting graphs. Zplot drawing routines are all built upon a set of low-level postscriptgenerating commands; these hide many of the details of generating correct postscript from the rest of Zplot, boiling down most activities to a set of drawing commands that place lines, shapes, and text on the drawing surface. I conclude with a set of examples.