graphviz-2999.17.0.2: Bindings to Graphviz for graph visualisation.

Copyright(c) Matthew Sackman, Ivan Lazar Miljenovic
License3-Clause BSD-style
MaintainerIvan.Miljenovic@gmail.com
Safe HaskellSafe-Inferred
LanguageHaskell2010

Data.GraphViz.Attributes

Contents

Description

There are almost 150 possible attributes available for Dot graphs, and it can be difficult to know which ones to use. This module provides helper functions for the most commonly used ones.

The complete list of all possible attributes can be found in Data.GraphViz.Attributes.Complete; it is possible to use both of these modules if you require specific extra attributes that are not provided here.

Synopsis

The definition of attributes

data Attribute Source

Attributes are used to customise the layout and design of Dot graphs. Care must be taken to ensure that the attribute you use is valid, as not all attributes can be used everywhere.

Creating labels

The following escape codes are available for labels (where applicable):

\N
Replace with the name of the node.
\G
Replace with the name of the graph (for node attributes) or the name of the graph or cluster, whichever is applicable (for graph, cluster and edge attributes).
\E
Replace with the name of the edge, formed by the two adjoining nodes and the edge type.
\T
Replace with the name of the node the edge is coming from.
\H
Replace with the name of the node the edge is going to.
\n
Centered newline.
\l
Left-justified newline.
\r
Right-justified newline.

toLabel :: Labellable a => a -> Attribute Source

Equivalent to Label . toLabelValue; the most common label Attribute.

textLabel :: Text -> Attribute Source

An alias for toLabel for use with the OverloadedStrings extension.

xLabel :: Labellable a => a -> Attribute Source

Create a label outside of a node/edge. Currently only in the Graphviz development branch (2.29.*).

xTextLabel :: Text -> Attribute Source

An alias for xLabel for use with the OverloadedStrings extension.

forceLabels :: Attribute Source

Force the positioning of xLabels, even when it will cause overlaps.

textLabelValue :: Text -> Label Source

An alias for toLabelValue for use with the OverloadedStrings extension.

class Labellable a where Source

A convenience class to make it easier to create labels. It is highly recommended that you make any other types that you wish to create labels from an instance of this class, preferably via the String or Text instances.

Methods

toLabelValue :: a -> Label Source

This function only creates a Label value to enable you to use it for Attributes such as HeadLabel, etc.

Colors

The recommended way of dealing with colors in Dot graphs is to use the named X11Colors rather than explicitly specifying RGB, RGBA or HSV colors.

These functions also allow you to use SVG and Brewer colors, but X11 colors are generally preferable. If you wish to use SVG colors, either import this module hiding X11Color or import the SVG module qualified.

data X11Color Source

The X11 colors that Graphviz uses. Note that these are slightly different from the "normal" X11 colors used (e.g. the inclusion of Crimson). Graphviz's list of colors also duplicated almost all Gray colors with Grey ones; parsing of an X11Color which is specified using "grey" will succeed, even for those that don't have the duplicate spelling (e.g. DarkSlateGray1).

Constructors

AliceBlue 
AntiqueWhite 
AntiqueWhite1 
AntiqueWhite2 
AntiqueWhite3 
AntiqueWhite4 
Aquamarine 
Aquamarine1 
Aquamarine2 
Aquamarine3 
Aquamarine4 
Azure 
Azure1 
Azure2 
Azure3 
Azure4 
Beige 
Bisque 
Bisque1 
Bisque2 
Bisque3 
Bisque4 
Black 
BlanchedAlmond 
Blue 
Blue1 
Blue2 
Blue3 
Blue4 
BlueViolet 
Brown 
Brown1 
Brown2 
Brown3 
Brown4 
Burlywood 
Burlywood1 
Burlywood2 
Burlywood3 
Burlywood4 
CadetBlue 
CadetBlue1 
CadetBlue2 
CadetBlue3 
CadetBlue4 
Chartreuse 
Chartreuse1 
Chartreuse2 
Chartreuse3 
Chartreuse4 
Chocolate 
Chocolate1 
Chocolate2 
Chocolate3 
Chocolate4 
Coral 
Coral1 
Coral2 
Coral3 
Coral4 
CornFlowerBlue 
CornSilk 
CornSilk1 
CornSilk2 
CornSilk3 
CornSilk4 
Crimson 
Cyan 
Cyan1 
Cyan2 
Cyan3 
Cyan4 
DarkGoldenrod 
DarkGoldenrod1 
DarkGoldenrod2 
DarkGoldenrod3 
DarkGoldenrod4 
DarkGreen 
Darkkhaki 
DarkOliveGreen 
DarkOliveGreen1 
DarkOliveGreen2 
DarkOliveGreen3 
DarkOliveGreen4 
DarkOrange 
DarkOrange1 
DarkOrange2 
DarkOrange3 
DarkOrange4 
DarkOrchid 
DarkOrchid1 
DarkOrchid2 
DarkOrchid3 
DarkOrchid4 
DarkSalmon 
DarkSeaGreen 
DarkSeaGreen1 
DarkSeaGreen2 
DarkSeaGreen3 
DarkSeaGreen4 
DarkSlateBlue 
DarkSlateGray 
DarkSlateGray1 
DarkSlateGray2 
DarkSlateGray3 
DarkSlateGray4 
DarkTurquoise 
DarkViolet 
DeepPink 
DeepPink1 
DeepPink2 
DeepPink3 
DeepPink4 
DeepSkyBlue 
DeepSkyBlue1 
DeepSkyBlue2 
DeepSkyBlue3 
DeepSkyBlue4 
DimGray 
DodgerBlue 
DodgerBlue1 
DodgerBlue2 
DodgerBlue3 
DodgerBlue4 
Firebrick 
Firebrick1 
Firebrick2 
Firebrick3 
Firebrick4 
FloralWhite 
ForestGreen 
Gainsboro 
GhostWhite 
Gold 
Gold1 
Gold2 
Gold3 
Gold4 
Goldenrod 
Goldenrod1 
Goldenrod2 
Goldenrod3 
Goldenrod4 
Gray 
Gray0 
Gray1 
Gray2 
Gray3 
Gray4 
Gray5 
Gray6 
Gray7 
Gray8 
Gray9 
Gray10 
Gray11 
Gray12 
Gray13 
Gray14 
Gray15 
Gray16 
Gray17 
Gray18 
Gray19 
Gray20 
Gray21 
Gray22 
Gray23 
Gray24 
Gray25 
Gray26 
Gray27 
Gray28 
Gray29 
Gray30 
Gray31 
Gray32 
Gray33 
Gray34 
Gray35 
Gray36 
Gray37 
Gray38 
Gray39 
Gray40 
Gray41 
Gray42 
Gray43 
Gray44 
Gray45 
Gray46 
Gray47 
Gray48 
Gray49 
Gray50 
Gray51 
Gray52 
Gray53 
Gray54 
Gray55 
Gray56 
Gray57 
Gray58 
Gray59 
Gray60 
Gray61 
Gray62 
Gray63 
Gray64 
Gray65 
Gray66 
Gray67 
Gray68 
Gray69 
Gray70 
Gray71 
Gray72 
Gray73 
Gray74 
Gray75 
Gray76 
Gray77 
Gray78 
Gray79 
Gray80 
Gray81 
Gray82 
Gray83 
Gray84 
Gray85 
Gray86 
Gray87 
Gray88 
Gray89 
Gray90 
Gray91 
Gray92 
Gray93 
Gray94 
Gray95 
Gray96 
Gray97 
Gray98 
Gray99 
Gray100 
Green 
Green1 
Green2 
Green3 
Green4 
GreenYellow 
HoneyDew 
HoneyDew1 
HoneyDew2 
HoneyDew3 
HoneyDew4 
HotPink 
HotPink1 
HotPink2 
HotPink3 
HotPink4 
IndianRed 
IndianRed1 
IndianRed2 
IndianRed3 
IndianRed4 
Indigo 
Ivory 
Ivory1 
Ivory2 
Ivory3 
Ivory4 
Khaki 
Khaki1 
Khaki2 
Khaki3 
Khaki4 
Lavender 
LavenderBlush 
LavenderBlush1 
LavenderBlush2 
LavenderBlush3 
LavenderBlush4 
LawnGreen 
LemonChiffon 
LemonChiffon1 
LemonChiffon2 
LemonChiffon3 
LemonChiffon4 
LightBlue 
LightBlue1 
LightBlue2 
LightBlue3 
LightBlue4 
LightCoral 
LightCyan 
LightCyan1 
LightCyan2 
LightCyan3 
LightCyan4 
LightGoldenrod 
LightGoldenrod1 
LightGoldenrod2 
LightGoldenrod3 
LightGoldenrod4 
LightGoldenrodYellow 
LightGray 
LightPink 
LightPink1 
LightPink2 
LightPink3 
LightPink4 
LightSalmon 
LightSalmon1 
LightSalmon2 
LightSalmon3 
LightSalmon4 
LightSeaGreen 
LightSkyBlue 
LightSkyBlue1 
LightSkyBlue2 
LightSkyBlue3 
LightSkyBlue4 
LightSlateBlue 
LightSlateGray 
LightSteelBlue 
LightSteelBlue1 
LightSteelBlue2 
LightSteelBlue3 
LightSteelBlue4 
LightYellow 
LightYellow1 
LightYellow2 
LightYellow3 
LightYellow4 
LimeGreen 
Linen 
Magenta 
Magenta1 
Magenta2 
Magenta3 
Magenta4 
Maroon 
Maroon1 
Maroon2 
Maroon3 
Maroon4 
MediumAquamarine 
MediumBlue 
MediumOrchid 
MediumOrchid1 
MediumOrchid2 
MediumOrchid3 
MediumOrchid4 
MediumPurple 
MediumPurple1 
MediumPurple2 
MediumPurple3 
MediumPurple4 
MediumSeaGreen 
MediumSlateBlue 
MediumSpringGreen 
MediumTurquoise 
MediumVioletRed 
MidnightBlue 
MintCream 
MistyRose 
MistyRose1 
MistyRose2 
MistyRose3 
MistyRose4 
Moccasin 
NavajoWhite 
NavajoWhite1 
NavajoWhite2 
NavajoWhite3 
NavajoWhite4 
Navy 
NavyBlue 
OldLace 
OliveDrab 
OliveDrab1 
OliveDrab2 
OliveDrab3 
OliveDrab4 
Orange 
Orange1 
Orange2 
Orange3 
Orange4 
OrangeRed 
OrangeRed1 
OrangeRed2 
OrangeRed3 
OrangeRed4 
Orchid 
Orchid1 
Orchid2 
Orchid3 
Orchid4 
PaleGoldenrod 
PaleGreen 
PaleGreen1 
PaleGreen2 
PaleGreen3 
PaleGreen4 
PaleTurquoise 
PaleTurquoise1 
PaleTurquoise2 
PaleTurquoise3 
PaleTurquoise4 
PaleVioletRed 
PaleVioletRed1 
PaleVioletRed2 
PaleVioletRed3 
PaleVioletRed4 
PapayaWhip 
PeachPuff 
PeachPuff1 
PeachPuff2 
PeachPuff3 
PeachPuff4 
Peru 
Pink 
Pink1 
Pink2 
Pink3 
Pink4 
Plum 
Plum1 
Plum2 
Plum3 
Plum4 
PowderBlue 
Purple 
Purple1 
Purple2 
Purple3 
Purple4 
Red 
Red1 
Red2 
Red3 
Red4 
RosyBrown 
RosyBrown1 
RosyBrown2 
RosyBrown3 
RosyBrown4 
RoyalBlue 
RoyalBlue1 
RoyalBlue2 
RoyalBlue3 
RoyalBlue4 
SaddleBrown 
Salmon 
Salmon1 
Salmon2 
Salmon3 
Salmon4 
SandyBrown 
SeaGreen 
SeaGreen1 
SeaGreen2 
SeaGreen3 
SeaGreen4 
SeaShell 
SeaShell1 
SeaShell2 
SeaShell3 
SeaShell4 
Sienna 
Sienna1 
Sienna2 
Sienna3 
Sienna4 
SkyBlue 
SkyBlue1 
SkyBlue2 
SkyBlue3 
SkyBlue4 
SlateBlue 
SlateBlue1 
SlateBlue2 
SlateBlue3 
SlateBlue4 
SlateGray 
SlateGray1 
SlateGray2 
SlateGray3 
SlateGray4 
Snow 
Snow1 
Snow2 
Snow3 
Snow4 
SpringGreen 
SpringGreen1 
SpringGreen2 
SpringGreen3 
SpringGreen4 
SteelBlue 
SteelBlue1 
SteelBlue2 
SteelBlue3 
SteelBlue4 
Tan 
Tan1 
Tan2 
Tan3 
Tan4 
Thistle 
Thistle1 
Thistle2 
Thistle3 
Thistle4 
Tomato 
Tomato1 
Tomato2 
Tomato3 
Tomato4 
Transparent

Equivalent to setting Style [SItem Invisible []].

Turquoise 
Turquoise1 
Turquoise2 
Turquoise3 
Turquoise4 
Violet 
VioletRed 
VioletRed1 
VioletRed2 
VioletRed3 
VioletRed4 
Wheat 
Wheat1 
Wheat2 
Wheat3 
Wheat4 
White 
WhiteSmoke 
Yellow 
Yellow1 
Yellow2 
Yellow3 
Yellow4 
YellowGreen 

bgColor :: NamedColor nc => nc -> Attribute Source

Specify the background color of a graph or cluster. For clusters, if style filled is used, then fillColor will override it.

bgColors :: NamedColor nc => nc -> nc -> Attribute Source

As with bgColor, but add a second color to create a gradient effect. Requires Graphviz >= 2.29.0.

fillColor :: NamedColor nc => nc -> Attribute Source

Specify the fill color of a node, cluster or arrowhead. Requires style filled for nodes and clusters. For nodes and edges, if this isn't set then the color value is used instead; for clusters, bgColor is used.

fillColors :: NamedColor nc => nc -> nc -> Attribute Source

As with fillColor, but add a second color to create a gradient effect. Requires Graphviz >= 2.29.0.

fontColor :: NamedColor nc => nc -> Attribute Source

Specify the color of text.

penColor :: NamedColor nc => nc -> Attribute Source

Specify the color of the bounding box of a cluster.

color :: NamedColor nc => nc -> Attribute Source

The color attribute serves several purposes. As such care must be taken when using it, and it is preferable to use those alternatives that are available when they exist.

  • The color of edges;
  • The bounding color of nodes;
  • The bounding color of clusters (i.e. equivalent to penColor);
  • If the filled Style is set, then it defines the background color of nodes and clusters unless fillColor or bgColor respectively is set.

Stylistic attributes

Various stylistic attributes to customise how items are drawn. Unless specified otherwise, all Styles are available for nodes; those specified also can be used for edges and clusters.

penWidth :: Double -> Attribute Source

Specify the width of lines. Valid for clusters, nodes and edges.

gradientAngle :: Int -> Attribute Source

Specify the angle at which gradient fills are drawn; for use with bgColors and fillColors. Requires Graphviz >= 2.29.0.

type Style = StyleItem Source

A particular style type to be used.

dashed :: Style Source

Also available for edges.

dotted :: Style Source

Also available for edges.

solid :: Style Source

Also available for edges.

bold :: Style Source

Also available for edges.

invis :: Style Source

Also available for edges.

filled :: Style Source

Also available for clusters.

diagonals :: Style Source

Only available for nodes.

striped :: Style Source

Only available for rectangularly-shaped nodes and clusters. Requires Graphviz >= 2.30.0.

wedged :: Style Source

Only available for elliptically-shaped nodes. Requires Graphviz >= 2.30.0.

rounded :: Style Source

Also available for clusters.

tapered :: Style Source

Only available for edges; creates a tapered edge between the two nodes. Requires Graphviz >= 2.29.0.

radial :: Style Source

Available for nodes, clusters and edges. When using gradientAngle, indicates that a radial gradient should be used. Requires Graphviz >= 2.29.0.

Node shapes

shape :: Shape -> Attribute Source

The shape of a node.

data Shape Source

Geometries of shapes are affected by the attributes Regular, Peripheries and Orientation.

Constructors

BoxShape

Has synonyms of rect and rectangle.

Polygon

Also affected by Sides, Skew and Distortion.

Ellipse

Has synonym of oval.

Circle 
PointShape

Only affected by Peripheries, Width and Height.

Egg 
Triangle 
PlainText

Has synonym of none. Recommended for HtmlLabels.

DiamondShape 
Trapezium 
Parallelogram 
House 
Pentagon 
Hexagon 
Septagon 
Octagon 
DoubleCircle 
DoubleOctagon 
TripleOctagon 
InvTriangle 
InvTrapezium 
InvHouse 
MDiamond 
MSquare 
MCircle 
Square 
Star

Requires Graphviz >= 2.32.0.

Underline

Requires Graphviz >= 2.36.0.

Note 
Tab 
Folder 
Box3D 
Component 
Promoter

Requires Graphviz >= 2.30.0.

CDS

Requires Graphviz >= 2.30.0.

Terminator

Requires Graphviz >= 2.30.0.

UTR

Requires Graphviz >= 2.30.0.

PrimerSite

Requires Graphviz >= 2.30.0.

RestrictionSite

Requires Graphviz >= 2.30.0.

FivePovOverhang

Requires Graphviz >= 2.30.0.

ThreePovOverhang

Requires Graphviz >= 2.30.0.

NoOverhang

Requires Graphviz >= 2.30.0.

Assembly

Requires Graphviz >= 2.30.0.

Signature

Requires Graphviz >= 2.30.0.

Insulator

Requires Graphviz >= 2.30.0.

Ribosite

Requires Graphviz >= 2.30.0.

RNAStab

Requires Graphviz >= 2.30.0.

ProteaseSite

Requires Graphviz >= 2.30.0.

ProteinStab

Requires Graphviz >= 2.30.0.

RPromoter

Requires Graphviz >= 2.30.0.

RArrow

Requires Graphviz >= 2.30.0.

LArrow

Requires Graphviz >= 2.30.0.

LPromoter

Requires Graphviz >= 2.30.0.

Record

Must specify the record shape with a Label.

MRecord

Must specify the record shape with a Label.

Edge arrows

arrowTo :: Arrow -> Attribute Source

How to draw the arrow at the node the edge is pointing to. For an undirected graph, requires either edgeEnds Forward or edgeEnds Both.

arrowFrom :: Arrow -> Attribute Source

How to draw the arrow at the node the edge is coming from. Requires either edgeEnds Back or edgeEnds Both.

Specifying where to draw arrows on an edge.

edgeEnds :: DirType -> Attribute Source

Specify where to place arrows on an edge.

data DirType Source

Specify where to place arrow heads on an edge.

Constructors

Forward

Draw a directed edge with an arrow to the node it's pointing go.

Back

Draw a reverse directed edge with an arrow to the node it's coming from.

Both

Draw arrows on both ends of the edge.

NoDir

Draw an undirected edge.

Default arrow types.

type Arrow = ArrowType Source

A particular way of drawing the end of an edge.

The 9 primitive arrows.

5 derived arrows.

Layout

ordering :: Order -> Attribute Source

Specify an ordering of edges of a node: either the outgoing or the incoming edges of a node must appear left-to-right in the same order in which they are defined in the input.

When specified as both a global graph or sub-graph level attribute, then it takes precedence over an attribute specified for an individual node.

data Order Source

Constructors

OutEdges

Draw outgoing edges in order specified.

InEdges

Draw incoming edges in order specified.

rank :: RankType -> Attribute Source

When using dot, this allows you to control relative placement of sub-graphs and clusters.