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 draw a graph using the code below .

enter image description here

\documentclass[tikz]{standalone}
\usetikzlibrary{
    shapes.geometric,
    positioning,
    fit,
    calc,
    patterns
}
\usepackage{tikz}
\usepackage{scalefnt}
\begin{document}

\pgfkeys{/tikz/.cd,
  gradient style init/.initial=left color,
  gradient style init/.get=\grsi,
  gradient style init/.store in=\grsi,
  gradient style end/.initial=right color,
  gradient style end/.get=\grse,
  gradient style end/.store in=\grse,
}

\tikzset{
 block/.style = {circle, draw,
    text width=1em,align=center,inner sep=0pt},
  line/.style = {draw,thick,->},
  oplus/.style={draw,circle, text width=1em,align=center,inner sep=0pt,
  postaction={path picture={%
    \draw[black]
      (path picture bounding box.south west) -- (path picture bounding box.north east)
      (path picture bounding box.north west) -- (path picture bounding box.south east);}}},
   my pattern/.style args={#1 colored by #2}{%
   path picture={
     \node[pattern=#1,pattern color=#2] at (path picture bounding box.center) {};
   }
  },
  my gradient/.style args={#1 and #2}{%
   \grsi=#1,
   \grse=#2,
 },
}
\begin{tikzpicture}
\node [block,my pattern=north east lines colored by blue!50,
  my gradient=orange!60 and yellow!40] (s13){13};
\end{tikzpicture}
\end{document} 

However, when I put the graph into a big tree, there is only two blue lines inside the circle. May I know what's the problem. Is the blue line related to the size of the circle? Here is the new code:

\documentclass[tikz]{standalone}
\usetikzlibrary{
    shapes.geometric,
    positioning,
    fit,
    calc,
    patterns
}
\usepackage{tikz}
\usepackage{scalefnt}
\begin{document}

\pgfkeys{/tikz/.cd,
  gradient style init/.initial=left color,
  gradient style init/.get=\grsi,
  gradient style init/.store in=\grsi,
  gradient style end/.initial=right color,
  gradient style end/.get=\grse,
  gradient style end/.store in=\grse,
}

\tikzset{
 block/.style = {circle, draw,
    text width=1em,align=center,inner sep=0pt},
  line/.style = {draw,thick,->},
  oplus/.style={draw,circle, text width=1em,align=center,inner sep=0pt,
  postaction={path picture={%
    \draw[black]
      (path picture bounding box.south west) -- (path picture bounding box.north east)
      (path picture bounding box.north west) -- (path picture bounding box.south east);}}},
   my pattern/.style args={#1 colored by #2}{%
   path picture={
     \node[pattern=#1,pattern color=#2] at (path picture bounding box.center) {};
   }
  },
  my gradient/.style args={#1 and #2}{%
   \grsi=#1,
   \grse=#2,
 },
}
{\scalefont{0.5}
\begin{tikzpicture}[node distance=4mm]
\node [block] (s1) {1};
\node [block,below = of s1] (s2) {2};
\node [block, below = of s2] (s5) {5};
\node [block,below = of s5,my pattern=north east lines colored by blue!50,
  my gradient=orange!60 and yellow!40] (s13){13};


\node [block, below = of s13] (s4) {4};

\end{tikzpicture}
}
\end{document} 

enter image description here

share|improve this question
    
A MWE should reproduce the problem? –  Peter Grill Feb 25 '13 at 6:58
    
@PeterGrill thanks, but the new code is very long :( –  sweetyBaby Feb 25 '13 at 7:00
    
Well the, I would recommend you should incorporate this code here into the smallest example that reproduces the problem. –  Peter Grill Feb 25 '13 at 7:01
    
@PeterGrill thanks, have updated the problem withe a MWE –  sweetyBaby Feb 25 '13 at 7:39
    
I think the problem comes with the positioning library: what happens if you try something like \node [block,my pattern=north west lines colored by blue!50, my gradient=orange!60 and yellow!40,yshift=-5mm] (s13) at (s5.south){13};? –  Claudio Fiandrino Feb 25 '13 at 9:03

1 Answer 1

up vote 5 down vote accepted

Perhaps, you can use

\begin{tikzpicture}[on grid,node distance=1cm]
\node [block] (s1) {1};
\node [block,below = of s1] (s2) {2};
\node [block, below = of s2] (s5) {5};

\node [block,my pattern=north east lines colored by blue!50,
  my gradient=orange!60 and yellow!40,below = of s5] (s13)  {13};
\node [block, below = of s13] (s4) {4};
\end{tikzpicture}

enter image description here

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.