xdot.py icon indicating copy to clipboard operation
xdot.py copied to clipboard

Prints only part of the graph into PDF file - with offset

Open yurivict opened this issue 3 years ago • 8 comments

image

By default it should paint a properly centered whole graph onto one page.

Version: py38-xdot-1.2 Python-3.8 OS: FreeBSD 13

yurivict avatar Oct 12 '21 19:10 yurivict

Can you please give some more detail on how you got to this output, so one can reproduce it?

Mome avatar Oct 25 '21 13:10 Mome

This DOT is clipped slightly when printed:

graph {
    rankdir=LR;
    a -- { b c d }; b -- { c e }; c -- { e f }; d -- { f g }; e -- h;
    f -- { h i j g }; g -- k; h -- { o l }; i -- { l m j }; j -- { m n k };
    k -- { n r }; l -- { o m }; m -- { o p n }; n -- { q r };
    o -- { s p }; p -- { s t q }; q -- { t r }; r -- t; s -- z; t -- z;
    { rank=same; b, c, d }
    { rank=same; e, f, g }
    { rank=same; h, i, j, k }
    { rank=same; l, m, n }
    { rank=same; o, p, q, r }
    { rank=same; s, t }
}                                                                                                                                                                                           

image

yurivict avatar Oct 25 '21 19:10 yurivict

crazy.gv.txt example prints like this:

image

yurivict avatar Oct 25 '21 19:10 yurivict

IMO, for large graphs xdot should offer the user to choose how many pages to split it into in X/Y directions. But it should never just clip graphs.

yurivict avatar Oct 25 '21 20:10 yurivict

OK, you used "print to file". Yes, I can confirm this looks really bad, and for me it also clips the graph the other way around.

In case you want to use another export feature, I added one in #96. However the pdf export will not stick to a paper page format.

Mome avatar Oct 26 '21 12:10 Mome

I press the Print button and then save as PDF.

yurivict avatar Oct 26 '21 15:10 yurivict

It sounds like https://github.com/jrfonseca/xdot.py/pull/96 might go some way to address this.

That said, I feel we're wandering outside the remit of xdot.py. I accepted printing because it was "easy". If it turns out it's not that easy, then I rather not burdern xdot.py with printing. xdot.py was meant for visualization. If folks want to convert dot to something else, they should just use Graphviz tools directly. xdot.py is not meant to be an UI for Graphviz tools. Just an interactive visualizer.

jrfonseca avatar Nov 27 '21 15:11 jrfonseca

Alternatively you can just fix the pdf writer to center the drawing properly in the page.

yurivict avatar Nov 27 '21 15:11 yurivict