Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I have problems using the new graph drawing features in TikZ 3.0 with shadows.

\documentclass{scrartcl}

\usepackage{tikz}
\usetikzlibrary{shadows,graphs,graphdrawing}
\usegdlibrary{force}
\tikzstyle{vertex}=[draw, circle, fill=white, circular drop shadow]
\tikzstyle{edge}=[draw,thick]

\begin{document}
\tikz
  \graph[spring layout, horizontal=a to b] {
    a[vertex] --[edge] b[vertex];
  };
\tikz
  \graph {
    a[vertex] --[edge] b[vertex];
  };
\end{document}

When using spring layout (I assume that this problem occurs with all layout algorithms) edges are behind the shadows. Without a layout algorithm the edges are above the shadows of vertices.

How can this be solved, so that edges are always above the shadow?

Output

share|improve this question
3  
Use the nodes behind edges option (p. 395, pgfmanual v3.0.0). –  Paul Gaborit Jan 11 at 0:33
    
That works, thanks a lot. –  Christoph Weyer Jan 13 at 10:49
    
@PaulGaborit please convert your comment to an answer so we can move this to the answered realm. :) –  Paul Gessler Feb 24 at 3:08

1 Answer 1

up vote 6 down vote accepted

You may use the nodes behind edges option (p. 395, pgfmanual v3.0.0).

enter image description here

\documentclass[margin=1mm]{standalone}
\usepackage{tikz}
\usetikzlibrary{shadows,graphs,graphdrawing}
\usegdlibrary{force}
\tikzstyle{vertex}=[draw, circle, fill=white, circular drop shadow]
\tikzstyle{edge}=[draw,thick]
\begin{document}

\tikz \graph[nodes behind edges,spring layout, horizontal=a to b]
  { a[vertex] --[edge] b[vertex];};

\tikz \graph { a[vertex] --[edge] b[vertex]; };
\end{document}
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.