3

How to draw following symbol using tikz?

And why isn't there a standard package which will have all necessary and commonly used shapes in flowcharts. Even existing flowchart package has very less inventory of shapes.

enter image description here

  • 1
    Welcome to TeX.SX! If you think that LaTeX is missing vital functionality then please write a package for it! :) – Andrew Dec 24 '17 at 8:30
  • Ha ha ha ... OK ;-) – charles bell Dec 24 '17 at 8:44
  • 1
    Apparently, there is no such agreement on necessary and commonly used shapes for flowcharts. – Heiko Oberdiek Dec 24 '17 at 8:46
  • Isn't that a multiplication junction? en.wikipedia.org/wiki/Frequency_mixer – endolith Jan 10 '19 at 17:04
7

For a flow chart a node style might be useful:

output of code

\documentclass{article}
\usepackage{tikz}
\definecolor{FlowChartBlue}{rgb}{.3,.5,.75}
\tikzset{
  summing junction/.style={
    circle,
    draw=FlowChartBlue!50!black,
    fill=FlowChartBlue,
    minimum size=2cm,
    path picture={
      \draw [FlowChartBlue!50!black]
            (path picture bounding box.135) -- (path picture bounding box.315)
            (path picture bounding box.45) -- (path picture bounding box.225);
    }
  }
}
\begin{document}
\begin{tikzpicture}
\node [summing junction] (a) at (0,0) {};
\node [summing junction] (b) at (4,2) {};

\draw [-latex] (a) to[bend left] (b);
\end{tikzpicture}
\end{document}

Just drawing

Another version, following comment. The clue here is that the + indicates that the coordinate is relative to the previous coordinate ((2,2) in the example).

I don't see how this is better than the above version though, as drawing lines to the circle is more complicated.

output of code

\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\filldraw[fill=blue!50] (2,2) circle[radius=1cm]
   +(45:1cm) -- +(225:1cm)
   +(135:1cm) -- +(315:1cm);

\filldraw[fill=blue!50] (4,1) circle[radius=1cm]
   +(45:1cm) -- +(225:1cm)
   +(135:1cm) -- +(315:1cm);
\end{tikzpicture}
\end{document}

Ellipses

output of code

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{shapes.geometric}
\tikzset{
  summing junction ellipse/.style={
    ellipse,
    draw=blue!50!black,
    fill=blue!50,
    minimum width=3cm,
    minimum height=1.5cm,
    path picture={
      \draw [blue!50!black]
            (path picture bounding box.135) -- (path picture bounding box.315)
            (path picture bounding box.45) -- (path picture bounding box.225);
    }
  }
}
\begin{document}
\begin{tikzpicture}
\filldraw[fill=blue!50] (2,2) circle[x radius=2cm, y radius=1cm]
   +(45:2cm and 1cm) -- +(225:2cm and 1cm)
   +(135:2cm and 1cm) -- +(315:2cm and 1cm);

\filldraw[fill=red!50] (4,-1) circle[x radius=2cm, y radius=1cm]
   +(60:2cm and 1cm) -- +(240:2cm and 1cm)
   +(120:2cm and 1cm) -- +(300:2cm and 1cm);

\node [summing junction ellipse,fill=green!50] at (8,1) {};
\end{tikzpicture}
\end{document}
  • can it be done without using \tikzset like in native syntax where we draw a circle first and then 'X' using lines. \draw (2cm,2cm) circle (2cm); and after this code to draw lines. – charles bell Dec 24 '17 at 9:26
  • 1
    @charlesbell Yes (see update), but I don't see why you would do that. – Torbjørn T. Dec 24 '17 at 9:47
  • I am having little problem while applying same thing with ellipse, is there any thing I can use in place of radius dimension i.e. 1cm, that will automatically limit length till the arc of ellipse. – charles bell Dec 24 '17 at 12:27
  • @charlesbell You can specify major and minor axis in polar coordinates, as mentioned in the manual (cf. Heiko's comment on his answer), e.g. (45:2cm and 1cm). See answer. – Torbjørn T. Dec 24 '17 at 13:08
  • Awesome! Thanks. Unfortunately I don't have enough reputation to upvote :-( – charles bell Dec 24 '17 at 13:12
4

The symbol can be easily drawn in TikZ using polar coordinates:

\documentclass{standalone}
\usepackage{tikz}
\definecolor{FlowChartBlue}{rgb}{.3,.5,.75}
\begin{document}
  \begin{tikzpicture}
    \def\Radius{10mm}
    \filldraw[fill=FlowChartBlue]
      (0, 0) circle[radius=\Radius]
      (135:\Radius) -- (315:\Radius)
      (45:\Radius) -- (225:\Radius)
    ;
  \end{tikzpicture}
\end{document}

Result

  • (135:\Radius) -- (315:\Radius) (45:\Radius) -- (225:\Radius) what does this syntax mean? – charles bell Dec 24 '17 at 8:43
  • @charlesbell See the documentation of TikZ: "13.2.1 Canvas, XYZ, and Polar Coordinate Systems". – Heiko Oberdiek Dec 24 '17 at 8:50
3

Not too difficult to draw with MetaPost either, for whom it may interest. Here the code is included in a LuaLaTeX program.

For sophisticated flowcharts with MetaPost, I've heard about the Metaflow package, but it's not on CTAN and I have not tried it yet.

\documentclass[border=3mm]{standalone}
\usepackage{luatex85,luamplib}
\begin{document}
\begin{mplibcode}
beginfig(1);
    radius := 3cm; path circle; circle = fullcircle scaled 2radius;
    fill circle withcolor .3red + .5green + .75blue; draw circle;
    path diameter; diameter = (left -- right) scaled radius rotated 45;
    draw diameter; draw diameter rotated 90;
endfig;
\end{mplibcode}
\end{document}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.