# tikz graph with boxes

i simply want to create something like this, i tried something like this:

\documentclass{beamer}

%layout
\mode<presentation>{
}
\usepackage{tikz}
\usepackage{pgfplots}

\begin{document}
\begin{frame}
\frametitle{Diagramm}
\begin{tikzpicture}
\begin{axis}[xmax=6,ymax=1]
{(0,1) (2,1)}
\closedcycle;
{(3,1) (6,1)}
\closedcycle;
\end{axis}
\end{tikzpicture}
\end{frame}
\end{document}

• Please understand that your code should be complete enough, starting with \documentclass, so we can copy&run it. The way it is everybody has to compensate posters lazyness, which may be a bad motivator for answers. Jun 14 at 12:56
• @MS-SPO thank you for your answer, i edited the original post. Jun 14 at 13:02
• I would suggest to draw it in tikz alone, and the first tutorial section in pgfmanual (html) introduces all commands and syntaxes you need. Jun 14 at 13:36

Try this code:

\documentclass{beamer}

%layout
\mode<presentation>{
}
\usepackage{tikz}
\usepackage{pgfplots}

\begin{document}
\begin{frame}
\frametitle{Diagramm}
\begin{tikzpicture}[scale=2]
\filldraw[green] (1,0) rectangle (2,1);
\node[text width=2cm] at (1.5,0.5) () {\bfseries \footnotesize Damit\\ beschatungen mir aus};
\filldraw[red] (3,0) rectangle (5.5,1);
\node at (4.25,0.5) () {\bfseries NP};
\draw[line width=3,-latex] (1,0)--(5.5,0);
\foreach \x in {1,...,5}
\draw (\x,0.1)--(\x,-.1) node[below] {\x};
\node at (3,-.5) () {\bfseries \footnotesize Maximale Anzahl von Literalen in jeder Klausel}

\end{tikzpicture}
\end{frame}
\end{document}


Output: