Graph Drawing Options - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

Online Help

All Products    Maple    MapleSim


Graph Drawing Options

a summary of options for specifying graph drawing styles

 

Description

Color Options

Vertex Border Options

Edge Line Options

Font Options

All Stylesheet Options

Nested Table or Record Stylesheets

Examples

Description

• 

A graph drawing style is given by stylesheet=value, where value is a list of keyword option equations or as a nested table or Record. When the options are given as a list, as many options can be specified as desired. Any options not specified will be drawn from the default options. When given as a table or Record, a full stylesheet should be given.

• 

To get the settings from older versions of Maple, specify stylesheet="legacy".

Color Options

• 

vertexcolor, vertexhighlightcolor, edgecolor, and edgehighlightcolor specify the default colors of vertices and edges in the graph. Highlighted components may have a color associated with them already, and if so, these options will not override that.

• 

Colors may be given in any form understood by Maple.

Vertex Border Options

• 

vertexborder, vertexthickness, vertexhighlightborder, and vertexhighlightthickness specify the style of the colored vertex region. vertexborder is either true or false while vertexthickness is any non-negative value.

Edge Line Options

• 

edgethickness and edgehighlightthickness specify the how edge lines and arrows are drawn.  They can take any non-negative value valid for a plot line thickness.

Font Options

• 

Fonts can be specified in two ways: in one option as a list or as three separate options. If the font of a component is specified as a list then the separate options will be ignored. The list options are edgefont, vertexfont, and vertexhighlightfont, which specify the fonts used for weight labels, vertex labels, and the labels of highlighted vertices. Their value should be a list with either two or three elements: family and size or family, style, and size.

• 

Fonts can also be given with individual options, but only the color options will be used if a list font option is also passed.

• 

Font options are anything supported by plots (see plot/options). In particular, the size should be a positive integer, the family must be the capitalized name of a font family supported by your operating system, and the style should be one of DEFAULT, BOLD, ITALIC, or OBLIQUE. See the FONT structure in plot,structure for all valid choices.

All Stylesheet Options

• 

All of the valid options for vertices are listed in the subsection below. They can be prefixed with either vertex or vertexhighlight.

Vertex Stylesheet Options

• 

The styles that are understood for vertices are:

– 

border : whether to draw the border (true or false), or a color. Special color values are supported.

• 

Special value "_contrast" (the default color) automatically sets the line color to a grayscale value that contrasts with the vertex color.

• 

Special value "_blend" sets the line color to the average of the colors of the vertex and the plot background.

• 

Special value "_match" sets the font color to the vertex color and the vertex is drawn in the background color. It also supports all the other formats in ColorTools/Format.

– 

color : color of the vertex. See ColorTools/Format.

– 

fontcolor : color of the vertex label. Special color values are supported.

• 

Special value "_contrast" (the default color) automatically sets the font to a grayscale value that contrasts with the vertex color.

• 

Special value "_match" sets the font color to the vertex color.

• 

Special value "_blend" also sets the font color to the vertex color. It also supports all the other formats in ColorTools/Format.

– 

fontsize : size of the vertex label, a positive integer in points

– 

fontfamily : font family to use for the vertex label, a string. See plot/options.

– 

fontstyle : font style to use for the vertex label, a string. See plot/options.

– 

font : shorthand to specify a vertex label font as a list either [family, size] or [family, style, size]

– 

padding : extra space around vertex label, a number in points

– 

shape : shape of the vertex, a string understood by plottools/polygonbyname or default.  Examples:

• 

ellipse, circle,

• 

common polygons up to ten sides, e.g., hexagon

• 

arbitrary regular polygons given as number-gon, e.g., 7gon

• 

a regular star version of polygons with more than 4 sides will be drawn if prefixed (with or without spaces) with star, e.g., star hexagon

• 

a flattened version of a polygon will be drawn if prefixed with wide, e.g., wide pentagon

• 

the wide and star prefixes can be combined in any order

• 

polygons are drawn with a flat bottom unless prefixed with inverted in which case it will have point bottom, e.g., inverted 9gon

• 

the inverted, star, and wide prefixes can be combined, but inverted must come first, though it can be abbreviated to inv, e.g., invwide13gon

– 

thickness : thickness of the border, a non-negative value

• 

All of the valid options for edges are listed in the subsection below. They can be prefixed with either edge or edgehighlight.

Edge Stylesheet Options

• 

The styles that are understood for edges are:

– 

arrowpos : the position of the arrow on a directed edge, a number between 0 and 1

– 

arrowsize : the length, in points, of the arrow on a directed edge

– 

arrowshape : a string understood by plottools/polygonbyname or "line" specifying the shape of the arrowhead on a directed edge

– 

color : color of the edge line. See ColorTools/Format. Special color values are supported

• 

Special value "_contrast" sets the color to a grayscale value that contrasts with the background color of the plot.

• 

Special value "_match" sets the font color to the weight color.

• 

Special value "_blend" also sets the font color to average of the colors of the vertices on each end of the edge.

– 

fontcolor : color of the weight label. See ColorTools/Format. Special color values are supported.

• 

Special value "_contrast" sets the font to a grayscale value that contrasts with the background color of the plot.

• 

Special value "_match" (the default) sets the font color to the edge color.

• 

Special value "_blend" also sets the font color to average of the colors of the vertices on each end of the edge.

– 

fontsize : size of the weight label in points, a positive integer

– 

fontfamily : font family to use for the weight label, a string. See plot/options.

– 

fontstyle : font style to use for the weight label, a string. See plot/options.

– 

font : shorthand to specify the weight label font as a list either [family, size] or [family, style, size]

– 

linestyle : style of the edge line, a string: solid, dot, dash, dashdot, longdash, spacedash, or spacedot. See plot/options.

– 

thickness : thickness of the edge line, a non-negative value

Nested Table or Record Stylesheets

• 

The nested table style format mirrors the options described above.  The top-level table should have subtables stored under "weight", "vertex", "edge", "vertex_highlight", and "edge_highlight".

  

Note: When the graph drawing style is given as a nested table or record, all of these options must be specified.

• 

The weight table has only a "font" subtable which has entries "family", a string, "style", a string, "size", an integer, and "color", a string.

• 

The vertex and vertex_highlight tables have entries "border" which should be a name true or false, "thickness", a non-negative number, "color", a string, and "font", a table with the same format as the one for weight.

• 

The edge and edge_highlight tables have entries "thickness", a non-negative number, and "color", a string.

• 

Any of the subtables can be replaced with a Record if desired.

Examples

withGraphTheory:

GGraph1,2,1,2,3,2,3,4,3,4,5,4,5,1,5

GGraph 1: a directed weighted graph with 5 vertices and 5 arc(s)

(1)

HighlightVertexG,2

HighlightEdgesG,2,3

The default style:

DrawGraphG

Changing a couple elements from the default style:

DrawGraphG,stylesheet=vertexcolor=Blue,vertexhighlightcolor=Orange

DrawGraphG,stylesheet=edgecolor=Blue,edgehighlightcolor=Orange

DrawGraphG,stylesheet=weightfont=TIMES,ITALIC,12

DrawGraphG,stylesheet=vertexfontstyle=BOLD

See Also

ColorTools[Color]

GraphTheory[DrawGraph]

GraphTheory[HighlightVertex]

plot/options