There are many user methods performing visualization of objects defined in the applications.
Most of them build the scenes from a little basic set of graphical primitives, such as point sets, graphs, or filled
polygonal areas. They have a few common attributes controlling their appearance, such as vertex color or line
width. The default values for these attributes are chosen by polymake's developers basing on their subjective taste,
so you are free to adapt them to your needs.
There are two ways to change the visual attributes. Permanent settings can be stored in your personal customization file
~/.polymake/customize.pl as assignments to custom variables, mostly often in the Visual::Color package.
The changes come into effect from the next polymake call and stay until removed manually from the file.
Besides this, almost all visualization methods accept optional attribute_name => value argument pairs, which change
the appearance of just the visual objects created by this call. This is especially useful for creating composite drawings with
several objects where you might want to distinguish them by different colors. Moreover, you are not constrained by constant
values as in the customization file. For many attributes, you can design dynamic mappings and pass them in the form of perl
arrays, hash maps, or subroutines. This is described below with more details.
Some attributes have more than one name. For example, a graph node can be referred to as Node or as Vertex, if the graph is
in fact the 1-skeleton of a polytope. You can use either name, the effect will be the same.
Please be aware that what follows describes only those attributes that are more or less independent of the visualization software,
and can be changed dynamically in the method calls. More software-specific settings can be found in the customization file.
Colors
All color settings may be specified either as RGB values with each component being an integer between 0 and 255 (for example,
'255 0 0' for red), or using standard symbolic names (for example, "red"). On the most UNIX and Linux systems, the
list of recognized color names is kept in the file /usr/X11R6/lib/X11/rgb.txt; if it isn't there, ask your system
administrator for assistance and store the location in your customization file.
Please be aware that some high-quality picture renderer like JavaView or POVRAY may distort the
visible colors by shading, paling and other transformations.
Color of the circles or boxes representing the points, graph nodes, polytope vertices, etc.
Following mappings are supported:
constant value
applies to all points
array: [ "color0", "color1", "color2", ... ]
each point gets its own color, indiced by the point number
hash map: { index => "color", ... }
the distinguished points get individual colors, the rest gets the default setting
code: sub { my $index=shift; ...; return $color }
the subroutine is called for each point index
Normally, the circle or box is filled with the chosen color, while the outline is either drawn as a thin black line or left
invisible, depending on the envolved visualization software. In a flat picture like graph or face lattice rendered with
PostScript or Metapost, you can also choose an alternative representation, where the nodes are drawn as white circles or boxes
surrounded with colored boundary. To achieve this, put the word border verbatim in front of
the color value, e.g. NodeColor => "border red" .
Color of the closed polygons, e.g. facets of polytopes. You can specify dynamic mappings of the facet index to
the individual facet color in the same fashion as for VertexColor.
Color of the graph edges, or ridges between the facets. For polytopes, only constant values are allowed.
For graphs, following mappings are supported:
constant value
applies to all edges
array: [ "color0", "color1", "color2", ... ]
obtain the color by indexing with the source node index
node-based hash: { index => "color", ... }
the edges incident to the distinguished nodes get individual colors, the rest gets the default seting
edge-based hash: { "s t" => "color", ... }
the distinguished edges get individual colors, the rest gets the default seting
code: sub { my ($s, $t)=shift->incident_nodes; ... return $color }
the subroutine is called with an edge iterator as an argument
Styles
Styles can describe any visual features other than color. The format of the style values is a sequence of keywords,
separated with white spaces. The visualization back-ends may parse the style values and interpret the parts they can
understand, quietly ignoring the rest. Theoretically you can introduce arbitrarily many own style names, provided your favorite
visualizer understands them. Below are described only those that make sense with more than one standard visualizer
(JavaView,geomview, PostScript.)
There are no default styles, but the visualizers may introduce own default values for some parameters; see the customization file.
Sets the diameter of the circle representing a point (node, vertex, ...). In a face-lattice drawing, sets the box border line width.
The value n is a multiplicative factor which is applied to the standard setting specific to the chosen visualization
back-end. The latter can be changed via customization file.
hidden
Make the points invisible, don't draw circles nor boxes.
You can specify a dynamic mapping of point index to the style similar to PointColor, but this is not implemented by all
visualizers.
The line width. The value n is a multiplicative factor which is applied to the standard setting specific to the chosen visualization
back-end. The latter can be changed via customization file.
hidden
Don't draw the edge.
For a polytope, the attribute can have only constant value for all edges. For a graph, you can specify various dynamic
mappings, similar to EdgeColor.
Labels
The labels are little pieces of text drawn near the vertices, facets, or other graphical elements. Normally, the labels are taken
from the corresponding property of the object being visualized, such as VERTEX_LABELS. If the object has no
explicit label property, the sequential numbering is taken instead.
Change the name of the visual object being created.
In an interactive viewer the object names are browsable via the GUI and can be used to identify the elements of the drawing,
choose the active target of mouse operations, make them invisible, etc. For example, JavaView shows the object
names in the geometry list accessible via Inspector -> Display menu.
Some non-interactive back-ends like metapost or graphviz cite the object names in the comments placed at the beginning of the
drawing commands for the respective object.
Set the title of the entire drawing.
Alternatively, you can specify the title in the first argument to the function compose.
Per default, the Name of the first visual object comprising the drawing is taken.
Where the drawing title eventually shows up, depends on the chosen visualizer.
For example, JavaView displays the title in the window title bar, while in the PostScript drawing the title becomes
the page name.