graphmod icon indicating copy to clipboard operation
graphmod copied to clipboard

Size attribute in resulting dot file causes output to be clipped

Open dnadales opened this issue 3 years ago • 8 comments

The resulting size attribute in the .dot file produces seems to cause dot to clip the graph. For instance, graphmod will output something like:

digraph G {
size="6,4";
...

And after running a dot with this file I see only a part of the diagram. Removing the size attribute fixes this problem.

Two questions:

  1. How is this size attribute determined.
  2. Is there a way to prevent graphmod from adding a size attribute?

Thanks!

dnadales avatar Jan 21 '21 13:01 dnadales

As a workaround setting -d to 0 seems to help.

dnadales avatar Jan 21 '21 13:01 dnadales

Hi, 6,4 is the default size, and you can use -d to specify other dimensions if you'd like. Is there something we should fix? I forget the details, but I vaguely recall that adding this attribute improved the layout of the graphs in many cases.

yav avatar Jan 21 '21 15:01 yav

Thanks for the quick reply :pray:

In my case using 6,4 ~~messes up~~ causes dot to severely clip all the diagrams I tried (using different repos). I wonder if it is possible to omit the size attribute by default, since the more ad-hoc 6,4 can be added via a command line argument.

dnadales avatar Jan 21 '21 15:01 dnadales

That's odd, I've never seen that happen... I don't think dot is supposed to clip anything, but rather scale the picture (http://graphviz.org/doc/info/attrs.html#d:size). Could you point me to a repo that shows the problem, so I can try to figure out something to do---I am a bit weary of removing the default outright, as without it graphs tend to get very wide, which leads to a lot of edges corssing.

yav avatar Jan 21 '21 16:01 yav

Sure, see for example this repo. You can try with the alonzo directory for instance.

So if I run:

▶ find alonzo -name "*.hs" | xargs graphmod -q  -p  > test.dot            
▶ dot test.dot -Tsvg -o test.svg

I get this svg as output:

image

It might help to report here the dot version I'm using:

▶ dot -V
dot - graphviz version 2.43.0 (0)

dnadales avatar Jan 21 '21 16:01 dnadales

Weird, I use the same version, and I can reproduce this, but only when dot generates svg. It looks fine with pdf, png, or when using xdot pythong script (which is very handy btw). I wonder if that's a bug or a feature...

yav avatar Jan 22 '21 01:01 yav

Hehe, no idea. But feel free to close this issue if keeping the ad-hoc size attribute makes sense to you. Hopefully people would find this issue if they run into the same problem. Alternatively we could add a note in the README or in the documentation.

dnadales avatar Jan 22 '21 09:01 dnadales

I ran into this too, glad to see the fix is so easy.

Graphmod is amazing by the way!

seagreen avatar Aug 26 '21 17:08 seagreen