[Tex/LaTex] How label position and color can be modified in tikzpicture in posters

labelspositioningposterstikz-pgf

I am working on a poster with fancytikzposter package, I cutted out the problematic part, it can be downloaded from here.

I created a tikzpicture inside the poster and some problems occured:

  1. labels are black and I want to change their colors to white, but I could not find out how
  2. labels are far from the nodes they belong to, I want to move them closer to the nodes
  3. one extra (but not so important): is it possible to mirror the frame of the labels on the second line (when labels are below the nodes)?

The problematic tikzpicture

Here is the code which belongs the tikzpicture above

\tikzstyle{input} = [draw, rectangle, rounded corners]

\begin{tikzpicture}[node distance=0.26\textwidth,>=latex', line width=4pt,anchor=south]
    \node [input, label={original} ] (signOrig) { \includegraphics[width=.14\textwidth]{Erika2b} };
    \node [input, label={grayscale},  right of=signOrig] (signGr) { \includegraphics[width=.14\textwidth]{Erika2b} };
    \node [input, label={binary},     right of=signGr] (signBin) { \includegraphics[width=.14\textwidth]{Erika_segm} };
    \node [input, label=below:{edges},      below of=signBin, node distance=0.3\textwidth] (signGray) { \includegraphics[width=.14\textwidth]{Erika2_edgeb} };
    \node [input, label=below:{segmented},  left of=signGray] (signDilate) { \includegraphics[width=.14\textwidth]{Erika_segm}};
    \node [input, label=below:{centerline}, left of=signDilate] (signBw) { \includegraphics[width=.14\textwidth]{Erika_skel}};

    \draw [->] (signOrig)   -- (signGr);
    \draw [->] (signGr)     -- (signBin);
    \draw [->] (signBin)    --  (signGray);
    \draw [->] (signGray)   -- (signDilate);
    \draw [->] (signDilate) -- (signBw);
\end{tikzpicture}

Best Answer

The problem is that labels are also nodes, and it seems that fancytikzposter defines a default node shape which is used everywhere (even in labels) which has two parts, one above for the "title" and other below for the "content".

When you write label={foo} a node is created with "foo" as title and empty space as content. It is this empty space which creates the extra distance between labels and nodes. For the nodes in the bottom part, the empty space is below the label, so it is not so inmediate to notice it.

This problem can be solved if you define an appropiate style for labels (for example my label) which uses rectangle as shape instead the default two-part used by fancytikzposter, and then specify that style in each label. In addition, you can prepare this style to use white color. For example:

\tikzset{my label/.style = {
   node distance=0pt, inner sep=8mm, 
   anchor=south, 
   rectangle, rounded corners=8mm, 
   white, fill=blocktitlefillcolor,
  }
}

and later:

\node [input, label={[my label]original}] (signOrig) { \includegraphics[width=.14\textwidth]{Erika2b} };
\node [input, label={[my label]grayscale},  right of=signOrig] (signGr) { \includegraphics[width=.14\textwidth]{Erika2b} };
\node [input, label={[my label]binary},     right of=signGr] (signBin) { \includegraphics[width=.14\textwidth]{Erika_segm} };
\node [input, label={[my label]below:edges},      below of=signBin, node distance=0.3\textwidth] (signGray) { \includegraphics[width=.  → 14\textwidth]{Erika2_edgeb} };
\node [input, label={[my label]below:segmented},  left of=signGray] (signDilate) { \includegraphics[width=.14\textwidth]{Erika_segm}};
\node [input, label={[my label]below:centerline}, left of=signDilate] (signBw) { \includegraphics[width=.14\textwidth]{Erika_skel}};

This will produce (I cropped the poster to the relevant part):

Result

Note however that you get a "complete" rounded rectangle, and not a semi-rectangle as you apparently wanted. To fake this kind of semi-rectangle you can follow a different approach. Instead of label, use normal nodes (also in a pre-defined style), drawn in background and slightly below the included images. The following code implements this idea:

\usetikzlibrary{shapes,arrows,positioning,backgrounds}
% ... 
    \tikzstyle{input} = [draw, rectangle, rounded corners, fill=white]
    \tikzset{my label/.style = {
       node distance=0pt,
       inner sep=12mm,
       rectangle,
       rounded corners=8mm,
       white,
       fill=blocktitlefillcolor,
  }
}
% ...
    \begin{tikzpicture}[node distance=0.26\textwidth,>=latex', line width=4pt,anchor=south]
        \node [input ] (signOrig) { \includegraphics[width=.14\textwidth]{Erika2b} };
        \node [input, right of=signOrig] (signGr) { \includegraphics[width=.14\textwidth]{Erika2b} };
        \node [input, right of=signGr] (signBin) { \includegraphics[width=.14\textwidth]{Erika_segm} };
        \node [input, below of=signBin, node distance=0.3\textwidth] (signGray) { \includegraphics[width=.14\textwidth]{Erika2_edgeb} };
        \node [input, left of=signGray] (signDilate) { \includegraphics[width=.14\textwidth]{Erika_segm}};
        \node [input, left of=signDilate] (signBw) { \includegraphics[width=.14\textwidth]{Erika_skel}};

        \begin{pgfonlayer}{background}
        \node [my label, above=-8mm of signOrig]   {original};
        \node [my label, above=-8mm of signGr]     {grayscale};
        \node [my label, above=-8mm of signBin]    {binary};
        \node [my label, below=-8mm of signBw]     {centerline};
        \node [my label, below=-8mm of signDilate] {segmented};
        \node [my label, below=-8mm of signGray]   {edges};
        \end{pgfonlayer}

        \draw [->] (signOrig)   -- (signGr);
        \draw [->] (signGr)     -- (signBin);
        \draw [->] (signBin)    --  (signGray);
        \draw [->] (signGray)   -- (signDilate);
        \draw [->] (signDilate) -- (signBw);
    \end{tikzpicture}

And this produces:

Result2

And also the code is easier to read, IMHO.

Related Question