Is there a way to draw "desks" (2 boxes side by side and 2 below them) without using arrows on graphviz?

Hi there, this is my first time on this forum!

i need to draw “desks” (my supervisor asked me to draw our office for my very first project, which is the infrastructure of the company) it contains 4 desks in total (i need to draw without the arrows for .py later!). I’m still new to graphviz and tried so many things but nothing worked out sadly.

thanks for reading this far, i hope someone can help me here :slight_smile:

Graphviz is not well suited for tasks like this. In general I would suggest pikchr (Pikchr: Documentation) or some interactive layout program.
That said:

graph D{
  graph [nodesep=.9  ranksep=.8] // tune these to rearrange nodes
  node [shape=rect fixedsize=true width=1.4 height=.5 label=""]
  edge [style=invis] // edges used, but are invisible

  {rank=same 
    d1a [group=a]  // group attributes may not be needed, but should not hurt
    d1b [group=b]
  }
  {rank=same 
    d2a [group=a]
    d2b [group=b]
  }
  d1a -- d2a
  d1b -- d2b
}

Giving:

fourRects

1 Like

I think we need more information about what you’re trying to accomplish. I don’t know what it means to draw 4 desks.

Fwiw when our office organises desk moves… we draw the floorplan in google sheets, using it basically as graph paper.

1 Like

Hi there!

I tried to draw it on my phone (thats what i was trying to draw, just 4 boxes with no arrows)

Thank you so much!

There is also an easier way using the osage layout engine, you can play with the packmode to align the desks differently, the packmode can be set at subgraph level as well to mix layouts:
graph {
layout=“osage”;
packmode=array_ut2;
node [shape=rect];

desk1;
desk2;
desk3;
desk4;
}
giving
[dot]
graph {
layout=“osage”;
packmode=array_ut2;
node [shape=rect];

desk1;
desk2;
desk3;
desk4;
}
[/dot]
graph {
layout=“osage”;
packmode=array_ut1;
node [shape=rect];

desk1;
desk2;
desk3;
desk4;
}
giving
[dot]
graph {
layout=“osage”;
packmode=array_ut1;
node [shape=rect];

desk1;
desk2;
desk3;
desk4;
}
[/dot]

2 Likes

didn’t knew about the layout osage, thank you so much!!

Congratulations to BartB! This seems to be the first time that osage has been suggested as a solution on the forum. (It is not in my go-to toolset, yet).
Fun to learn about new (old) solutions.

thanks

2 Likes

Hi Steve, i use osage quit often in my work as an architect, i like to keep layers (clusters) of a diagram ordered for consistency in communication. I found that clusters jumping places from one presentation to the next using dot are confusing for most people.

An example of one of my diagrams i maintain using osage layout and https://exceltographviz.com/).

1 Like

Cool. I haven’t played with osage, yet - but it is on my “to do” list. Thanks.