diagrams: Embedded domain-specific language for declarative vector graphics

[ bsd3, graphics, library ] [ Propose Tags ] [ Report a vulnerability ]

Diagrams is a full-featured framework and embedded domain-specific langauge for creating declarative vector graphics and animations.

This package is just a convenient wrapper around the diagrams-core, diagrams-lib and diagrams-contrib packages, so they can be installed with a single cabal install diagrams command.

The package also comes with flags to enable six different backends. A Haskell-native SVG backend (the diagrams-svg package) can be selected with -fsvg. This flag is enabled by default, so if you do not want the SVG backend, you must explicitly disable it with -f-svg. The SVG backend does not yet quite support all the features of the cairo backend: text alignment and embedded images are the two main missing features at this point, and of course it can only produce SVG images. It is, however, much easier to install, so it is the out-of-the-box default.

There is also a cairo backend (the diagrams-cairo package) which can be selected with the -fcairo flag. It is fully-featured and can produce PNG, PS, PDF, SVG, or animated GIF output; however, due to its dependencies it can be difficult to install on some platforms (notably OS X).

In addition, there is a GTK backend based on the cairo backend, for rendering diagrams directly to GTK windows. You can enable it with the -fgtk flag.

The Haskell-native postscript backend (the diagrams-postscript package) can be selected with the -fpostscript flag. The only feature it does not support is transparency.

There is a Rasterific backend which is also Haskell-native (the diagrams-rasterific package) which can be selected with the -frasterific flag. This is a fully featured backend with the ability to produce PNG, JPG, TIFF, BMP and animated GIF output.

There is a Canvas backend, also haskell native, which can be selected with the -fcanvas flag. This backend allows users to write interactive images onto their web browsers.

Finally there is a PGF backend, suitable for producing diagrams that can be natively embedded in LaTeX documents, which can be selected with the -fpgf flag.

For more information, including a gallery of examples, tutorial, and user manual, see the diagrams website: http://diagrams.github.io. For help, join the #diagrams IRC channel on Freenode or the mailing list: http://groups.google.com/group/diagrams-discuss.


[Skip to Readme]

Flags

Manual Flags

NameDescriptionDefault
cairo

Enable the cairo backend

Disabled
gtk

Enable the GTK backend

Disabled
svg

Enable the Haskell-native SVG backend

Enabled
ps

Enable the Haskell-native PostScript backend

Disabled
postscript

Enable the Haskell-native PostScript backend

Disabled
rasterific

Enable the Haskell-native Rasterific backend

Disabled
canvas

Enable the Haskell-native Canvas backend

Disabled
pgf

Enable the Haskell-native PGF backend

Disabled

Use -f <flag> to enable a flag, or -f -<flag> to disable that flag. More info

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

  • No Candidates
Versions [RSS] 0.1, 0.2, 0.2.1, 0.2.1.1, 0.2.1.2, 0.2.1.3, 0.2.2, 0.2.2.1, 0.2.2.2, 0.2.2.3, 0.3, 0.4, 0.5, 0.6, 0.7, 0.7.1, 0.7.1.1, 1.0, 1.0.0.1, 1.1, 1.1.0.1, 1.2, 1.3, 1.3.0.1, 1.4, 1.4.0.1, 1.4.1
Change log CHANGES.md
Dependencies diagrams-contrib (>=1.4 && <1.5), diagrams-core (>=1.4 && <1.6), diagrams-lib (>=1.4 && <1.5), diagrams-svg (>=1.4 && <1.5) [details]
Tested with ghc ==8.8.4 || ==8.10.7 || ==9.0.2 || ==9.2.7 || ==9.4.5 || ==9.6.1
License BSD-3-Clause
Author Brent Yorgey
Maintainer diagrams-discuss@googlegroups.com
Category Graphics
Home page http://diagrams.github.io
Bug tracker http://github.com/diagrams/diagrams/issues
Source repo head: git clone git://github.com/diagrams/diagrams.git
Uploaded by BrentYorgey at 2023-07-11T11:17:09Z
Distributions LTSHaskell:1.4.1, NixOS:1.4.1, Stackage:1.4.1
Reverse Dependencies 13 direct, 13 indirect [details]
Downloads 34681 total (94 in the last 30 days)
Rating 2.75 (votes: 9) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs pending
Build status unknown [no reports yet]

Readme for diagrams-1.4.1

[back to package description]

![Build Status](http://gondor.hendrix.edu:8080/buildStatus/icon?job=Diagrams HEAD)

diagrams is a full-featured framework and domain-specific language (embedded in Haskell) for creating declarative vector graphics and animations.

This package is just a convenient wrapper around the diagrams-core, diagrams-lib, diagrams-svg, and diagrams-contrib packages, so they can be installed with a single cabal install --lib diagrams command.

The package also comes with flags to enable six different backends. The native SVG backend is enabled by the -fsvg flag and is enabled by default. If you don't want it, you must explicitly disable it with -f-svg.

The native postscript backend is disabled by default but can be enabled by the -fps flag.

The cairo backend is disabled by default but can be selected with the -fcairo flag. In addition, the GTK backend is based on the cairo backend (but split into a separate package to make installing the cairo backend easier). It can be selected with the fgtk flag.

The native rasterific backend which is disabled by default but can be selected with the -frasterific flag.

The native canvas backend which is disabled by default but can be selected with the -fcanvas flag.

Installation

cabal update && cabal install --lib diagrams

or, to get the postscript backend in addition to the SVG backend:

cabal update && cabal install --lib -fps diagrams

or, to get the cairo backend in addition to the SVG backend:

cabal update && cabal install gtk2hs-buildtools && cabal install --lib -fcairo diagrams

Reporting bugs

Issue trackers for all diagrams-related repositories are hosted under the diagrams organization on github. If you know the specific package containing the bug, report it in the issue tracker specific to that package (for example, diagrams-lib). Otherwise, just report the issue in the issue tracker for the general diagrams repository.

Further reading

For more information, including a gallery of examples, tutorial, and user manual, see the diagrams website. For help, join the #diagrams IRC channel on Freenode or the mailing list.