Opened 5 years ago

Closed 13 months ago

#22070 closed defect (fixed)

dot2tex produces tikz code with missing \filldraw lines

Reported by: slabbe Owned by:
Priority: major Milestone: sage-9.2
Component: packages: optional Keywords:
Cc: Merged in:
Authors: Sébastien Labbé Reviewers: Frédéric Chapoton
Report Upstream: N/A Work issues:
Branch: 89d387a (Commits, GitHub, GitLab) Commit: 89d387a992a982467c23a40ff5e4070a26fa5eb0
Dependencies: Stopgaps:

Status badges

Description

Recent ticket #21918 brings up a problem with dot2tex.

edges = [(i,(i+1)%3,a) for i,a in enumerate('abc')]
G_no_labels = DiGraph(edges)
G_with_labels = DiGraph(edges)
C = [[0,1], [2]]
kwds = dict(subgraph_clusters=C,color_by_label=True,prog='dot',format='dot2tex')
G_no_labels.latex_options().set_options(edge_labels=False, **kwds)
G_with_labels.latex_options().set_options(edge_labels=True, **kwds)
sage: view(G_no_labels)    # works fine
sage: view(G_with_labels)  # is missing cluster rectangles

Other problematic examples were provided in #21918:comment:6.

Change History (8)

comment:1 Changed 5 years ago by slabbe

With labels, some \filldraw line is missing in one of the tikz scope:

sage: latex(G_no_labels)    # works fine
...
sage: latex(G_with_labels)
\begin{tikzpicture}[>=latex,line join=bevel,]
%%
\begin{scope}
  \pgfsetstrokecolor{black}
  \definecolor{strokecol}{rgb}{0.0,0.0,0.0};
  \pgfsetstrokecolor{strokecol}
  \definecolor{fillcol}{rgb}{0.94,1.0,1.0};
  \pgfsetfillcolor{fillcol}
\end{scope}
\begin{scope}
  \pgfsetstrokecolor{black}
  \definecolor{strokecol}{rgb}{0.0,0.0,0.0};
  \pgfsetstrokecolor{strokecol}
  \definecolor{fillcol}{rgb}{0.94,1.0,1.0};
  \pgfsetfillcolor{fillcol}
  \filldraw (25.0bp,8.0bp) -- (25.0bp,37.0bp) -- (53.0bp,37.0bp) -- (53.0bp,8.0bp) -- cycle;
\end{scope}
...
\end{tikzpicture}

It seems to be because of a missing elif op == 'F' clause inside of the function do_draw_op of dot2tex.py file (see #21918:comment:11).

comment:2 Changed 13 months ago by chapoton

this works fine now (9.2.beta1)

comment:3 Changed 13 months ago by slabbe

I agree. Same for me.

comment:4 Changed 13 months ago by chapoton

Should we add a doctest ?

comment:5 Changed 13 months ago by slabbe

maybe a minimal one which only tests the presence of two occurrences of "filldraw", to avoid it to be fragile to other changes in the output...

comment:6 Changed 13 months ago by slabbe

  • Authors set to Sébastien Labbé
  • Branch set to u/slabbe/22070
  • Commit set to 89d387a992a982467c23a40ff5e4070a26fa5eb0
  • Status changed from new to needs_review

New commits:

89d387a22070: dot2tex produces tikz code with missing \filldraw lines

comment:7 Changed 13 months ago by chapoton

  • Milestone changed from sage-7.5 to sage-9.2
  • Reviewers set to Frédéric Chapoton
  • Status changed from needs_review to positive_review

C'est bon, le patchbot est tout vert. Je passe en positif. Merci

comment:8 Changed 13 months ago by vbraun

  • Branch changed from u/slabbe/22070 to 89d387a992a982467c23a40ff5e4070a26fa5eb0
  • Resolution set to fixed
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.