# TikZ- Filling a circle with a Pattern- Unexpected behavior

Can anyone help me understand why this behavior?

\documentclass[journal]{IEEEtran}
\usepackage[pdftex]{graphicx}
\usepackage{tikz,pgfplots}
\usetikzlibrary{arrows,shapes,chains,matrix,positioning,scopes,patterns}
\begin{document}
\begin{tikzpicture}[>=latex,
\def\r{0.2}
\node[point] (23) at (0,0){$p_{2,3}$};
\node[empty] (21) [left=of 22] {};

\end{tikzpicture}
\end{document}


This doesn't result in three types of nodes (circles), instead all I see is two different types either no fill or filled with black color circle nodes. I tried all combinations like

1) shaded/.style={circle,radius=\r,draw,pattern=north west lines,pattern color=blue}," replaced by "shaded/.style={circle,radius=\r,draw,fill=none,pattern=north west lines,pattern color=blue},

2)Trying to draw the circle manually without using the predefined style and giving the option of \draw[pattern,pattern color] and still the same problem.

Edit: If i use the above piece of code stand alone, now I seem to get the expected three styles of nodes/circles. But as part of a another bigger document I seem to be running into the problem i.e., something else overriding it and I see filled black circles even when i define it using \node[shaded].

\documentclass[journal]{IEEEtran}
\usepackage[pdftex]{graphicx}
\usepackage{tikz,pgfplots}
\usetikzlibrary{arrows,shapes,chains,matrix,positioning,scopes,patterns}
\begin{document}
%Lot of remaining part of the journal is here%
\begin{figure}[h!]
\centering
\begin{tikzpicture}[>=latex,
\def\r{0.2}
\node[point] (23) at (0,0){$p_{2,3}$};
\node[empty] (21) [left=of 22] {};

\end{tikzpicture}
\label{Fig:MP_Scheduling}
\end{figure}
\end{document}


Edit 2:

\usepackage[usenames,dvipsnames]{pstricks}
\usepackage[usenames,dvipsnames]{xcolor}


After elimination process I've figured out the problem. The above two lines in the Preamble are causing the problem. I am sorry for the naivety in using the libraries without knowing the exact purpose. But why should these two lines cause this problem?

• Can you please complete your code snippet to a compilable minimal working example MWE? BTW: Welcome to TeX.SE! – Mensch Jan 25 '15 at 18:34
• After suitable completion of your code I get the three expected styles compiling with pdflatex. – Gonzalo Medina Jan 25 '15 at 18:42
• I did the changes asked and I hope i am clearer now. Sorry for the inconvenience – mathamateur Jan 25 '15 at 19:10
• Perhaps you redefined elsewhere the shaded style? It's hard (almost impossible) to detect the problem without some example code reproducing it. – Gonzalo Medina Jan 25 '15 at 21:03

The order of package loading is important here: load xcolor and pstricks (if you really need both TikZ and PStricks) before loading tikz, as in

\usepackage[usenames,dvipsnames]{xcolor}
\usepackage[usenames,dvipsnames]{pstricks}
\usepackage{tikz,pgfplots}


A better approach here would be to pass usenames and dvipsnames as class options, so they will be picked by every responsive package, in particular, pstricks and xcolor; furthermore, since xcolor is internally loaded by tikz, you don't need to load it explicitly. You can then simply say:

\documentclass[journal,usenames,dvipsnames]{IEEEtran}
\usepackage{graphicx}
\usepackage{pstricks}
\usepackage{tikz,pgfplots}


By the way, never pass driver options to graphicx; instead of

\usepackage[pdftex]{graphicx}


use simply

\usepackage{graphicx}