10

How to create watercolor-like "shadow" to highlight some node on figure, like in image below?

Note that I don't need for coloring to fill a shape, nor do I need for it to have variable intensity, nor pointy edges like in Watercolor in tikz question.

graph with watercolor-like highlighting of nodes

2 Answers 2

13

I'm not sure which of the things shown you want. The ones on the right or the ones on the left? Will it always be circles?

I've assumed not always circles and both. However, I've used circles for my examples, but this is just convenience.

Four possibilities:

4 possibilities

The four circles are all drawn in the same way in gray with 50% opacity as circular nodes with width 10mm. The first one has a blue shadow added using a style. The other three are pics with various combinations of painting over, shadowing over etc.

\documentclass[tikz,border=10pt,multi]{standalone}
\usetikzlibrary{shadows,fit,decorations.pathmorphing}
\tikzset{
  overfill/.pic={
    \node [pic actions] {};
    \scoped[scale=1.25]{\node [fill=#1!50, scale=1.25, opacity=.5] {};}
  },
  shadow fill/.style={general shadow={shadow scale=1.25, inner color=#1!25, outer color=#1!5}},
  over paint/.pic={
    \node (a) [pic actions] {};
    \scoped[scale=1.25]{\node (b) [shape=rectangle, fit=(a)] {};}
    \path [decoration={random steps, segment length=2.5mm}, rounded corners=1.25pt, decorate, fill=#1!50, opacity=.5] (b.north) -| (b.south east) -| (b.north west) -- cycle;
  },
  shadow over paint/.pic={
    \node (a) [pic actions] {};
    \scoped[scale=1.25]{\node (b) [shape=rectangle, fit=(a)] {};}
    \path [decoration={random steps, segment length=2.5mm}, rounded corners=2pt, decorate, general shadow={shadow scale=1.25, inner color=#1!50, outer color=#1!25, opacity=.5}] (b.north) -| (b.south east) -| (b.north west) -- cycle;
  },
}
\begin{document}
\begin{tikzpicture}
  \node [circle, draw=gray, draw opacity=.5, minimum size=10mm, shadow fill=blue] {};
  \pic [circle, draw=gray, draw opacity=.5, minimum size=10mm] at (2,0) {overfill=green};
  \pic [circle, draw=gray, draw opacity=.5, minimum size=10mm] at (0,-2) {over paint=orange};
  \pic [circle, draw=gray, draw opacity=.5, minimum size=10mm] at (2,-2) {shadow over paint=red};
\end{tikzpicture}
\end{document}
13

I'm not sure if you want the whole graph, but here's an example node. The commands to build it might change depending on the use you want to make of it.

Output

example image

Code

\documentclass[margin=10pt]{standalone}
\usepackage{tikz}

\usetikzlibrary{fadings,decorations.pathmorphing}

\tikzfading[name=fade out,
    inner color=transparent!0,
    outer color=transparent!100]

\tikzset{
    nod/.style={circle, draw=blue!50!green, fill=white, inner sep=0, outer sep=0}
}

\newcommand{\mynode}[4][1]{
\scalebox{#1}{
    \node[nod, minimum size=3cm] (#2) at (#3) {};
    \fill[#4,
        decoration={random steps,segment length=4mm,amplitude=3mm},
        decorate,
        rounded corners,
        path fading=fade out
    ] (#3) circle (2cm);
}
}

\begin{document}
\begin{tikzpicture}

\mynode{A}{0,0}{yellow!30}

\end{tikzpicture}
\end{document}

You must log in to answer this question.

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