Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Size attribute in resulting dot file causes output to be clipped #32

Open
dnadales opened this issue Jan 21, 2021 · 8 comments
Open

Size attribute in resulting dot file causes output to be clipped #32

dnadales opened this issue Jan 21, 2021 · 8 comments

Comments

@dnadales
Copy link

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
Copy link
Author

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

@yav
Copy link
Owner

yav commented Jan 21, 2021

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.

@dnadales
Copy link
Author

dnadales commented Jan 21, 2021

Thanks for the quick reply 🙏

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.

@yav
Copy link
Owner

yav commented Jan 21, 2021

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.

@dnadales
Copy link
Author

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)

@yav
Copy link
Owner

yav commented Jan 22, 2021

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...

@dnadales
Copy link
Author

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.

@seagreen
Copy link

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

Graphmod is amazing by the way!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants