Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Graphviz: reducing margin on skewed polygon node

Tags:

graphviz

dot

I want to use a skewed polygon (aka parallelogram) on Graphviz, the problem is there is too much space between parallelogram border and it's text.

digraph G {
    poly1[margin=0, width=0, height=0, shape=polygon, label="This is a polygon\nwithout skew"]
    poly2[margin=0, width=0, height=0, shape=polygon, label="This is a polygon\nwith skew", skew=0.3]
}

This is the result of previous code:

Graphviz polygon w/ and w/o skew

As you can see, as soon I set a skew value (ìn this case skew=0.3) the polygon's interior margin increases a lot. Setting margin=0, width=0 and height=0 does not solve the issue.

Is there a way to remove the polygon's interior margin?

like image 871
jawira Avatar asked Oct 19 '25 02:10

jawira


1 Answers

There's a way, but it ain't pretty:

digraph G {
    poly1[margin=0, width=0, height=0, shape=polygon, label="This is a polygon\nwithout skew"]
    poly2[margin=0, width=1.8, height=0.46, shape=polygon, fixedsize=true, label="This is a polygon\nwith skew", skew=0.3]
}

Adding fixedsize=true and specifying the node's width and height (by trial and error) yields this:

skewed result :)

like image 61
marapet Avatar answered Oct 22 '25 05:10

marapet



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!