I'm creating a customisable TikZ pic where I want to enable or disable certain parts of it (e.g. some labels). Is there a style that I can pass to a node, pic, path or so that doesn't visibly draw it? So basically like draw=none, except that it should also extend to text, fill and so on.

One first try would be \tikzset{none/.style={draw=none,fill=none,text opacity=0}}, but I can't believe there is no "proper solution" for this. Maybe there is, and I just don't know which style to look for.

See for example how my first try could be used:



    \begin{tikzpicture}[bla/.pic={\node {A};},none/.style={draw=none,fill=none,text opacity=0}]
        \pic at (0,0) {bla};
        \pic[none] at (2,0) {bla};

        \node at (0,2) {B};
        \node[none] at (2,2) {B};

        \draw (0,4) -- node[right] {C} (0,5);
        \draw[none] (0,4) -- node[right] {C} (0,5);


Edit: As Percusse points out, it might be hard to make TeX actually not draw it, so maybe it's easier to ask how to invisibly draw it.

  • PDF objects and TikZ operands are not organically connected. Some options are just turned on and stay as such. And pgfkeys are not commutative so the last one wins. So the implementation can be quite cumbersome of such. That's also the reason why we don't have return to default style. Because all keys must be swept to reset everything. Instead draw your picture with that option in mind and append none to stuff that you want to turn off. Then you can activate/deactivate on demand.
    – percusse
    Dec 1, 2014 at 12:15
  • @Percusse, right, but thankfully TikZ styles are sort of scoped. Also, I'm not really interested in not drawing the objects, but rather "drawing them invisibly".
    – Turion
    Dec 1, 2014 at 12:18
  • Please provide an MWE rather than expecting people to start from scratch!
    – cfr
    Dec 1, 2014 at 12:24

1 Answer 1


I would define a style and either use it in all the constructions where you want this capability or scope the portions of the diagram which you want to turn off visible and invisible construction:



\begin{tikzpicture}[bla/.pic={\node {A};},
                  none/.style={text opacity=0,opacity=0,fill opacity=0},
                  my path/.style={},
                  %<line 1>%my path/.style={every path/.style={none},none},
                  %<line 2>%my path

  \pic at (0,0) {bla};
  \pic at (2,0) {bla};

  \begin{scope}[line width=8pt,draw=red,my path]
    \node (SB1) at (0,2) {SB1};
    \node (SB2) at (2,2) {SB2};
    \draw (SB1) -- (SB2);

  \draw  (0,4) -- node[right] (C1) {C1} (0,5);
  \draw  (2,4) -- node[right] (C2) {C2} (2,5);

  \draw[my path] (SB1) -- (SB2);

  \draw[red,line width=2pt] (current bounding box.north east) -- (current bounding box.west);

  \fill[fill=blue!30,my path] (current bounding box.north east) rectangle (current bounding box.west);



By uncommenting %<line 1>% you can get the style applied where you want it. By uncommenting %<line 2>% you can more universally apply it.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .