3

I am new to LaTex. I am trying to make diagram like, Here is how I want to make my image

My Latex code for this, is

\begin{figure}[H]
\centering

\begin{tikzpicture}[node distance = 4cm, auto]
    % Place nodes
    \node [block] (inst) (imp) {Spark SQL};
    \node [block, right=1cm of imp] (data) {Spark Streaming};
    \node [block, right=1cm of data] (sql) {MLib-Machine Learning};
    \node [block, right=1cm of sql] (runsql) {GraphX};
    \node [block, align=left,  minimum width=10cm, below=1cm of runsql] (visual) {Apache Spark};

\end{tikzpicture}
    \caption{The Spark stack}
    \label{fig:sysblocks}
\end{figure}

With this code, I am able to get image like this. This is how above code renders image.

Any Help would be great. Thanks in advance.

  • 1
    Hi, welcome to TeX.sx. Do the answers to this other question help you with your problem? http://tex.stackexchange.com/questions/23480/creating-a-node-fitting-the-horizontal-width-of-two-other-nodes – Fritz Oct 22 '15 at 11:34

1 Answers1

1

I solved this using following code:

\begin{tikzpicture}[node distance = .4cm, auto]
    % Place nodes
    \node [block] (inst) (imp) {Spark SQL};
    \node [block, right=0.5cm of imp] (data) {Spark Streaming};
    \node [block, right=0.5cm of data] (sql) {MLib-Machine Learning};
    \node [block, right=0.5cm of sql] (runsql) {GraphX};
     \path let \p1=($(imp.west)-(runsql.east)$),
              \n1 = {veclen(\p1)-0.4pt} 
              in node[block, below=of imp.south west, anchor=north west, minimum width=\n1] {Apache Spark};
\end{tikzpicture}
    \caption{The Spark stack}
    \label{fig:sysblocks}
\end{figure}