3

In the diagram below, I want to change the place of the rectangle and the circle with each other. I want the rectangle be placed on the left and the circle on the right. How can I do it?

One more thing, is there a way to change the circle to a rectangle or an oval? enter image description here

\smartdiagramset{description title text width=2.5cm,
    description text width=8cm,description width=10cm}
\smartdiagram[descriptive diagram]{
    {$ Step ~1 $,abcdefghigklmno pqrst uvwxyz}% <==============
}
2
  • 2
    Please write a minimal working example. See link for more details what it means.
    – user202729
    Jul 20, 2022 at 14:25
  • (Although it looks like you're using the 2 corresponding packages.)
    – user202729
    Jul 20, 2022 at 14:26

3 Answers 3

5

I use plain TikZ, with some styles of the above answer of @Ignasi, without using the matrix library.

enter image description here

\documentclass[tikz,border=5mm]{standalone}
\usetikzlibrary{shadows,shapes.geometric}
\tikzset{
basic/.style={rounded corners,draw=gray,drop shadow,align=center,font=\sffamily},
filling/.style={top color=white,bottom color=#1!80},
description/.style={basic,text width=5cm},
title/.style={basic,ellipse,text width=2cm},
}
\begin{document}
\begin{tikzpicture}
\path[nodes={filling=teal}]
(0,0) node[description] (A) {It is defined as a long piece of timber or metal}
(A.east) node[right,title]{Beam}
;
\path[nodes={filling=magenta}]
(0,-1.2) node[description] (B) {It is a plant having yellow flowers}
(B.east) node[right,title]{Daffodil}
;
\path[nodes={filling=orange}]
(0,-2.4) node[description] (C) {It is defined as a system \dots}
(C.east) node[right,title]{Galaxy}
;
\end{tikzpicture}
\end{document} 
1
  • 1
    Thanks a lot. That is exactly what I want
    – kawsar
    Jul 20, 2022 at 19:58
3

I think that you will have to change smartdiagram code to change the position of descriptions and text. As i don't know how to do it, here you have a possible alternative with a matrix. There are probably better ways for changing row colors, but I don't know them. I'm open to alternatives.

\documentclass[tikz]{standalone}
\usetikzlibrary{matrix, shadows, shapes.geometric}

\tikzset{
basic/.style={rectangle, rounded corners, draw=gray,  drop shadow, 
    align=center, anchor=center, font=\sffamily},
filling/.style={top color=#1!10, bottom color=#1!80},
title/.style={basic, ellipse, text width=2cm},
description/.style={basic, text width=5cm}
}

\begin{document}
\begin{tikzpicture}
\matrix[matrix of nodes, column sep=1pt, row sep=3mm, 
    column 1/.style={nodes={description}},
    column 2/.style={nodes={title}},
    row 1/.style={nodes={filling=blue}},
    row 2/.style={nodes={filling=red}},
    row 3/.style={nodes={filling=green}},
    ]{
    It is defined as a long piece of timber or metal & Beam\\
    It is a plant having yellow flowers & Daffodil\\
    It is defined as a system \dots & Galaxy\\};

\end{tikzpicture}
\end{document}

enter image description here

2
  • title and description are styles without parameters
    – Black Mild
    Jul 20, 2022 at 17:16
  • 1
    @BlackMild You are right. From a previous version code. I've corrected it. Thank you.
    – Ignasi
    Jul 21, 2022 at 9:18
3

Actually, you can change the arrangement of the nodes by editing the styles quite easily:

\documentclass{article}
\usepackage{smartdiagram}

\tikzset{
   description title/.append style={
      anchor=west
   },
   description/.append style={
      anchor=east
   }
}

\begin{document}

\smartdiagramset{description title text width=2.5cm,
    description text width=8cm,description width=10cm}
\smartdiagram[descriptive diagram]{
    {$ Step ~1 $,abcdefghigklmno pqrst uvwxyz}% <==============
}

\end{document}

enter image description here

The only flaw with this approach is that the shadow of the description box covers the node with the step, which is due to the fact that the nodes are still drawn in the same order as before.

If you want to change this behavior, you need to define your own diagram based on the code the package provides. Sasly, the package provides no easy way to add custom styles and it is not feasable to patch the relevant internal commands.

\documentclass{article}
\usepackage{smartdiagram}

\tikzset{
   description title/.append style={
      anchor=west
   },
   description/.append style={
      anchor=east
   }
}

\makeatletter
\newcommand{\smartRevDescriptiveDiagram}[1]{%
    \begin{tikzpicture}[every node/.style={align=center,let hypenation}]
        \foreach \smitem [count=\xi] in {#1}{%
            \edef\col{\@nameuse{color@\xi}}
            %%% reverse the order of the subitems:
            \let\revsitem\empty
            \foreach\currentsmitem in \smitem {
                \ifx\revsitem\empty
                    \xdef\revsitem{\currentsmitem}%
                \else
                    \xdef\revsitem{\currentsmitem,\revsitem}%
                \fi
            }
            %%%
            \foreach \subitem [count=\xii] in \revsitem{%
            \ifnumequal{\xii}{1}{% true
                \node[description,drop shadow]
                (module\xi) at (0,0-\xi*\sm@core@descriptiveitemsysep) {\subitem};
            }{}
            \ifnumequal{\xii}{2}{% true
                \node[description title,drop shadow]
                (module-title\xi) at (0,0-\xi*\sm@core@descriptiveitemsysep) {\subitem};
                }{}
            }%
        }%
    \end{tikzpicture}%
}
\makeatother

\begin{document}

\smartdiagramset{description title text width=2.5cm,
    description text width=8cm,description width=10cm}
\smartRevDescriptiveDiagram{
    {$ Step ~1 $,abcdefghigklmno pqrst uvwxyz}% <==============
}

\end{document}

enter image description here


Finally, as shown in the other answers already, using TikZ's shapes.geometric library, you can change the shape of the circle to an ellipse:

\documentclass{article}
\usepackage{smartdiagram}
\usetikzlibrary{shapes.geometric}

\tikzset{
   description title/.append style={
      anchor=west,
      ellipse,
      inner ysep=10pt
   },
   description/.append style={
      anchor=east,
   }
}

\makeatletter
\newcommand{\smartRevDescriptiveDiagram}[1]{%
    \begin{tikzpicture}[every node/.style={align=center, let hypenation}]
        \foreach \smitem [count=\xi] in {#1}{%
            \edef\col{\@nameuse{color@\xi}}
            %%% reverse the order of the subitems:
            \let\revsitem\empty
            \foreach\currentsmitem in \smitem {
                \ifx\revsitem\empty
                    \xdef\revsitem{\currentsmitem}%
                \else
                    \xdef\revsitem{\currentsmitem,\revsitem}%
                \fi
            }
            %%%
            \foreach \subitem [count=\xii] in \revsitem{%
            \ifnumequal{\xii}{1}{% true
                \node[description, drop shadow]
                (module\xi) at (0,0-\xi*\sm@core@descriptiveitemsysep) {\subitem};
            }{}
            \ifnumequal{\xii}{2}{% true
                \node[description title, drop shadow]
                (module-title\xi) at (0,0-\xi*\sm@core@descriptiveitemsysep) {\subitem};
                }{}
            }%
        }%
    \end{tikzpicture}%
}
\makeatother

\begin{document}

\smartdiagramset{
    description title text width=2.5cm,
    description text width=8cm, 
    description width=10cm
}
\smartRevDescriptiveDiagram{
    {$ Step ~1 $,abcdefghigklmno pqrst uvwxyz}% <==============
}

\end{document}

enter image description here

You must log in to answer this question.

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