`posets/text/plot_poset` := TEXT(
`   `,
`FUNCTION:  plot_poset - plot posets (or acyclic directed graphs)`,
`   `,
`CALLING SEQUENCE:  plot_poset(P,<options>);`,
`                   plot_poset(P,X,<options>);`,
`                   plot_poset(P,n,<options>);`,
`   `,
`PARAMETERS:  P     = a poset (or acyclic directed graph)`,
`             X     = a set (the vertex set)`,
`             n     = a positive integer (the number of vertices)`,
`         <options> = any of the following, in any order:`,
`            (1) 'dot', or dot=<filename>`,
`            (2) 'proportional'`,
`            (3) levels=<list>`,
`            (4) stretch=<number>`,
`            (5) ecolor=<color>, or ecolor=<table>`,
`            (6) vcolor=<color> `,
`            (7) 'labels', or labels=<table> `,
`            (8) any options known to plots[display]`,
`   `,
`SYNOPSIS:`,
`  plot_poset(P,X) plots the Hasse diagram of a poset P with vertex set X`,
`  using Maple 2D graphics or (optionally) writes a description of P in`,
`  the "dot" language for external processing by the Graphviz package.`,
`  For information about dot and Graphviz, see <http://www.graphviz.org/>.`,
`   `,
`  plot_poset(P,n) does the same, if {1,...,n} is the vertex set of P.`,
`  plot_poset(P) does the same, assuming that P has no isolated vertices.`,
`   `,
`  The procedure also operates correctly on acyclic directed graphs.`,
`   `,
`  The default layout algorithm for Maple 2D plots proceeds as follows.`,
`  First, the vertex set is partitioned into levels according to 'filter',`,
`  and the vertices within each level are ordered left-to-right by 'sort'.`,
`  An initial layout is then chosen, with equal horizontal spacing between`,
`  the vertices in each level and edges represented by straight lines.`,
`  Finally, an adjustment algorithm is used to horizontally shift the`,
`  positions of vertices until there are no "phantom" relations`,
`  (i.e., line segments that pass through vertices of P).`,
`   `,
`  For dot plots, the default layout algorithm is dependent on the external`,
`  software used to process the output.`,
`   `,
`  There are several options for controlling the form of the plot:`,
`   `,
`  'dot'`,
`   Write to the terminal a description of the plot in the dot language,`,
`   suitable for use by the Graphviz package. The default is a Maple plot.`,
`   `,
`  dot=<filename>`,
`   Same as above, except that the output is written to the named file`,
`   using a Maple 'writeto' command. If there is an existing file with the`,
`   same name, it is overwritten.`,
`   `,
` 'proportional'`,
`   Force the horizontal spacing between vertices in each level to be`,
`   inversely proportional to the number of vertices in that level. This`,
`   tends to produce better-looking plots for posets in which there is`,
`   extreme variation in the number of vertices in consecutive levels. `,
`   This option is ignored in dot plots.`,
`   `,
`  levels=<list>`,
`   Use the given list to partition the vertex set into levels. The i-th`,
`   item of the list must be a set or list that specifies which vertices`,
`   should appear at the i-th level. An error is signaled if the vertex`,
`   set of P does not coincide with the union of the level sets. Another`,
`   error is signaled if there is an edge [x,y] such that vertex x is in`,
`   a level at or above the level of vertex y.`,
`   `,
`   In Maple plots, if the i-th level is specified as a list, then the`,
`   left-to-right ordering of the list is preserved in the layout; if it`,
`   is a set, the left-to-right ordering is determined by applying 'sort'.`,
`   The default is levels=filter(P,X).`,
`   `,
`   In dot plots, the left-to-right ordering within each level is`,
`   determined by the external software used to process the output.`,
`   `,
`  stretch=<number>`,
`   Stretch the vertical axis by the indicated factor. In some versions`,
`   of Maple, similar effects may be achieved by selecting 'Unconstrained'`,
`   from the 'Projection' menu of a plot, and then reshaping the window.`,
`   This option is ignored in dot plots.`,
`   `,
`  ecolor=<color>`,
`   Specify the color of the edges in the plot. The default color is set`,
`   by the global variable ``posets/default``[ecolor] and may be redefined`,
`   by the user. The initial default value is 'red'.`,
`   `,
`  ecolor=<table>`,
`   Specify individual colors for each (covering) edge of P. The entries`,
`   of the table should be subsets of the covering edges of P, and the`,
`   index corresponding to a given entry should be the desired color for`,
`   the given set of edges. Any edge of P not occurring in one of the`,
`   color-sets will be assigned the default edge color.`,
`   `,
`  vcolor=<color>`,
`   Specify the color of the vertices and text labels in the plot. The`,
`   default color is set by the global variable ``posets/default``[vcolor]`,
`   and may be redefined by the user. The initial default value is 'black'`,
`   (in Maple V R4 or later) or 'white' (in Maple V R3 or earlier).`,
`   Note that in dot plots, 'white' is probably not what you want.`,
`   `,
` 'labels'`,
`   Specify that the vertices of P should be represented in the plot by`,
`   their names, rather than by points (the default).`,
`   `,
`  labels=<table>`,
`   Specify a label for each vertex of P. The indices of the table should`,
`   be the vertices of P, and the corresponding entries are the desired`,
`   labels. The entries must be of type 'string' (not names or numbers).`,
`   If any vertex of P is missing from the table, an error is signaled.`,
`   `,
`  In Maple plots, any options not recognized by plot_poset are passed as`,
`  arguments to plots[display]. In dot plots, these options are ignored.`,
`   `,
`EXAMPLES:`,
`  P:=J({},4);`,
`  plot_poset(P,stretch=0.9,title=``Boolean Algebra on 4 Points``);`,
`  Q:=subinterval(P,[1,12]);`,
`  C:=table([green=Q]);`,
`  plot_poset(P,ecolor=C,labels);`,
`   `,
`  P:={[1,2],[2,3],[4,3],[4,5],[5,6]};`,
`  ranked(P,6,'R'),R;`,
`  plot_poset(P,levels=R,vcolor=blue);`,
`   `,
`  P:=({},1) &+ rand_poset(20,0.3);`,
`  plot_poset(P,stretch=1.5);`,
`  plot_poset(P,vcolor=black,'dot');`,
`  M:=mobius(P):`,
`  L:=table([seq(i=convert(M[1,i],'string'),i=1..21)]);`,
`  plot_poset(P,labels=L);`,
`  plot_poset(P,labels=L,vcolor=black,dot=``myplot.dot``);`,
`   `,
`  P:=({},1) &+ ({},2) &+ ({},10) &+ ({},2) &+ ({},1);`,
`  plot_poset(P,proportional);`,
`   `,
`  P:=J(chain(4),5); P:={op(P),[3,11],[11,8],[5,12],[12,9]};`,
`  plot_poset(P,labels);`,
`  F:=filter(P); F:=subsop(2=[3,2],3={4,5},4=[11,6,7,12],F);`,
`  plot_poset(P,levels=F,labels);`,
`   `,
`SEE ALSO:  colors, filter, plot[options], plots[display], writeto`,
NULL):

if `+`(0)=0 then # Maple V.4 or later
  print(INTERFACE_HELP(insert, topic=`posets/plot_poset`,
  helpfile=HomeLib, text=`posets/text/plot_poset`))
elif ceil(0)=0 then # Maple V.2 or V.3
  `help/posets/text/plot_poset`:=`posets/text/plot_poset`:
  save `help/posets/text/plot_poset`, cat(HomeLib,`/help/posets/text/plot_poset.m`)
fi:
