Description
This LaTeX code defines a document with two TikZ pictures side by side, each enclosed in a colored background rectangle. The TikZ pictures depict two sets of circular nodes arranged in specific patterns, with some nodes filled with green color and others unfilled. The first TikZ picture represents uniform patterns, where each circle in a specific pattern has the same number of filled nodes, and the second picture represents non-uniform patterns where each circle in a specific pattern has a different number of filled nodes. The pattern of nodes in each circle is defined using a custom command pics/pattern
that takes arguments to specify the type of node and its position in the pattern. The circles in each pattern are labelled using letters a
, b
, c
, d
, and e
. The code also includes some text labels to describe the patterns and their properties.
Keywords
latex, tikz, xcolor, positioning, backgrounds, circle, draw, fill, minimum size, pics, pattern, node, scale, text width, align.
Source Code
\documentclass[varwidth]{standalone}
\usepackage{tikz}
\usepackage{xcolor}
\usetikzlibrary{positioning}
\usetikzlibrary{backgrounds}
\tikzset{
% styling for filled node
filled/.style={circle,draw,fill=green!60, minimum size=5},
% styling for white nodes
empty/.style={circle,draw, minimum size=5},
% diagram with P = 4
pics/pattern/.style args={#1/#2/#3/#4/#5}{
code={
\node[#1] at (0, 1) (#5-1) {};
\node[#2] at (1, 0) (#5-2) {};
\node[#3] at (0, -1) (#5-3) {};
\node[#4] at (-1, 0) (#5-4) {};
}},
pics/pattern/.default=empty/empty/empty/empty/a
}
\begin{document}
\begin{tikzpicture}[background rectangle/.style={fill=blue!15}, show background rectangle]
% Uniform LBP, and draw box
% U = 0 Row
\node[] at (-2,0) {U=0};
\path (0,0) pic[scale=1.0] {pattern};
\path (+3.5,0) pic[scale=1.0] {pattern=filled/filled/filled/filled/a};
% U = 2 Row
\node[] at (-2,-3) {U=2};
\path (0,-3) pic[scale=1.0] {pattern=filled/empty/empty/empty/b};
\path (+3.5,-3) pic[scale=1.0] {pattern=filled/filled/empty/empty/c};
\path (+7.0,-3) pic[scale=1.0] {pattern=filled/filled/filled/empty/d};
\node[text width= 2cm] at (7.0, 1) {\LARGE{Uniform \hfill \break Patterns}};
\end{tikzpicture}
%
\begin{tikzpicture}[background rectangle/.style={fill=red!15}, show background rectangle]
% Uniform LBP, and draw box
% U = 4 Row. i think
\node[] at (-2,0) {U=4};
\path (0,0) pic[scale=1.0] {pattern=empty/filled/empty/filled/e};
\path (+3.5,0) pic[scale=1.0] {pattern=filled/empty/filled/empty/f};
\node[text width= 4cm, align=right] at (6, 1) {\hfill \LARGE{Non-Uniform} \break \hfill \break \LARGE{Patterns}};
\end{tikzpicture}
\end{document}