Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Postscript backend for Diagrams.
Haskell

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
example
src
.gitignore
.travis.yml
CHANGES.markdown
LICENSE
README.markdown
Setup.hs
diagrams-postscript.cabal

README.markdown

Build Status

diagrams-postscript is a rendering backend for diagrams, a powerful, flexible, declarative domain-specific language for creating vector graphics, using the Haskell programming language.

diagrams-postscript has a simple rendering engine that outputs PostScript™ language files and is an officially supported backend for diagrams.

Installation

cabal update && cabal install diagrams-postscript

Basic usage

A simple example that uses diagrams-postscript to draw a blue circle:

import Diagrams.Prelude
import Diagrams.Backend.Postscript.CmdLine

d = circle 1 # fc blue

main = mainWith (pad 1.1 d)

Save this to file named Circle.hs and compile it:

ghc --make Circle.hs

This will generate an executable which, when run, outputs a blue circle to some file. Run the executable with the --help option to find out more about how to call it.

$ ./Circle --help
./Circle

Usage: ./Circle [-w|--width WIDTH] [-h|--height HEIGHT] [-o|--output OUTPUT]
  Command-line diagram generation.

Available options:
  -?,--help                Show this help text
  -w,--width WIDTH         Desired WIDTH of the output image
  -h,--height HEIGHT       Desired HEIGHT of the output image
  -o,--output OUTPUT       OUTPUT file

The output type will be automatically determined from the file extension. Currently EPS and PS are supported.

$ ./Circle -o circle.eps -w 400

The command above generates an EPS file with a width of 400pt.

Advanced usage

Instead of just creating a standalone executable, the postscript backend can also be called from within a larger program. For more information, see the Diagram.Backend.Postscript module.

PostScript™ is a trademark of Adobe.

Something went wrong with that request. Please try again.