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.
Normally, a color attribute specifies the filling color of an element. Depending on , the
outline can be drawn as a black thin line or left invisible. Some visualization packages, esp. PostScript,
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, this color is used to fill the circle or box, while the outline is either drawn as a thin black line or left
invisible, depending on the chosen visualization software. Some visualization packages, especially PostScript, allow an
alternative representation as a white circle or box with colored boundary. To achieve this, prepend the word border
to 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 edges 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 software packages 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 favourite
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.
The line width. The measure units are visualizer-specific.
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. The only operation you may apply when calling the
visualization method is to suppress the labels completely.
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.
Non-interactive viewers like PostScript renderer usually ignore the object names.
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.