diagram: Plot Diagrams of Ordered or Linked Relations

diagramR Documentation

Plot Diagrams of Ordered or Linked Relations

Description

A function to plot and manipulate Hasse and Concept diagrams of ordered relations, or the Egg-box of a semigroup structure.

Usage

diagram(x, type = c("hasse", "concept", "egg-box"), attrs = NULL, main = NULL, 
        incmp, shape = c("rectangle", "circle", "box", "ellipse"), col, col0, 
        fcol, ecol, lty, lbs, ffamily, fstyle, fsize, cex.main, col.main, bg, 
        mar, sep, ...)

Arguments

x

Matrix representing ordered relations.

type

Type of diagram:

  • hasse Hasse diagram of partially ordered relations.

  • concept Concept lattice of a formal context.

  • egg-box Egg-box diagram of an abstract semigroup.

For "egg-box" type diagram, the following arguments are ignored:

attrs

(optional) a list of lists with diagram attributes for node, edge, and graph.

main

(optional) Main title of the plot diagram.

incmp

(optional and logical) Should incomparable elements be included in the lattice diagram?

shape

(optional) Shape of diagram vertices: "rectangle", "circle", "box", "ellipse".

col

(optional) Colourr of diagram vertices.

col0

(optional) Colour of contour in diagram vertices.

fcol

(optional) Font colour of text in diagram vertices.

ecol

(optional) Edge colour of diagram edges.

lty

(optional) Integer for the shape of diagram edges.

lbs

(optional) Labels of elements in x partially ordered set.

ffamily

(optional) Font family of vertex labels in diagram.

fstyle

(optional) Font style of vertex labels in diagram with options: bold, italic, bolditalic.

fsize

(optional) Font size of vertex labels in diagram.

cex.main

(optional) Font size of title in plot diagram.

col.main

(optional) Font colour of title in plot diagram.

bg

(optional) Background colour of plot diagram.

mar

(optional) Margins of plot vindue.

sep

(optional only for concept) Pair separator for pairwise relations inside intents and extents.

...

(optional) Additional graphical items.

Details

diagram is a wrapper function for plotting and manipulating “Hasse”, “Concept”, and “Egg-box” diagrams.

The first two diagram types represent systems of ordered relations and are displayed as partial or linear order diagrams. For example, the partial order table produced by the ‘strings’ option in the partial.order function can be plotted as a Hasse diagram. Another example comes from Galois derivations in Formal Concept Analysis, where a Concept diagram shows the ordering of formal concepts defined by intents and extents. Roman numerals are rendered for diagram elements when the partial order table in x is not labelled.

On the other hand, the Egg-box “diagram” represents equivalence classes in an abstract semigroup without a partial order structure, and such representation is in the Console, not on the Graphic Device as the other representations.

Value

Depending on the type diagram:

hasse

a Hasse diagram of partially ordered relations

concept

a Concept diagram of formal concepts in a formal context

egg-box

an Egg-box of an abstract semigroup

Note

This function requires Rgraphviz package installed.

See Also

hasse, partial.order, strings, galois, green.rel, diagram.levels, as.strings, ccgraph.

Examples

# load a dataset
data("incubA")

# a partial order of strings from dataset image matrix
po <- incubA |> getElement("IM") |> 
  as.strings() |> 
  partial.order(type="strings")

# plot the order relation as a Hasse diagram
## Not run: if(require(Rgraphviz)) {
plot(diagram(po, type="hasse"))
}
## End(Not run)

multiplex documentation built on July 30, 2026, 5:13 p.m.