25

Is it possible to use the grid pattern on a node but also setting a background color to it, say blue?

I want to use something like

\node (b) [fill=red, pattern=grid] {b};

I am aware of the solution here: How to combine fill and pattern in a pgfplot bar plot?, but it does not seem to apply directly to a node. Thanks in advance!

Leshui
  • 363
  • 1
  • 3
  • 6

1 Answers1

39
\documentclass{article}
\usepackage{tikz}
\begin{document}
\usetikzlibrary{patterns}
\tikz{\node[preaction={fill, red}, pattern=grid] {b};}
\end{document}

Result:

enter image description here

JLDiaz
  • 55,732