Graphics
Image ↓
How to add images Image positioning How to add captions and a label to an image How to rotate and scale back an image
Charts ↓
Introduction & SmartDiagram TikZ: Simple Drawings TikZ: Advanced Commands PGFPlots
Tables ↓
Environment Cell spanning Positioning Coloring
Vector drawing ↓
Latexdraw Putting things together
Introduction & SmartDiagram

Simple charts, drawings and diagrams
In this part of the graphics section we plan on covering the basics of the following packages:
  1. SmartDiagram
  2. TikZ
  3. PGFPlots
They range from easiest to hardest as they all come from the same "PGFPlots" package and their only difference is the level of the syntax used. SmartDiagram is simpler and more accessible but going down through TikZ and finally to the "root" package which is PGFPlots you won't have a higher level language anymore, meaning the learning curve will be harder but you will also have more freedom. What you should expect from this tutorial is how to make basic diagrams and draw effectively in LaTeX at a beginner level. Of course, if you feel brave enough to delve into the packages documentation, go ahead, no one will stop you:
SmartDiagram
With that said, let's get right into business, starting off from the top of our list with our first drawing package: "SmartDiagram". As the name suggests, the aim of the package is to provide the user with an easy way of drawing diagrams to use in presentations or text documents. It is a pretty intuitive package and should not give many issues during the learning process. Note that the SmartDiagram package automatically loads the TikZ, etoolbox, xparse, xtring packages along with the backgrounds, calcs, fadings, shadows, shapes.arrows, shapes.symbols TikZ libraries. The basic command to make diagrams is \smartdiagram[type of diagram]{item list} where each item should be separated by a comma.
The diagram types you can insert are the following:*
*Note that the following elements are written with capital letters for the sake of a better appearance. Every diagram type should be written without capital letters when used as actual code. With this, we'll be going through the main types of diagrams with their own example. They're all pretty easy to draw with the given command but they can be further modified by adding options using the \smartdiagramset{list of options} command. We'll list the general options here: you will then be able to find the specific ones in their respective diagram section.
Circular Diagram
The following example shows you how LaTeX compiles the basic \smartdiagram[circular diagram] command:


CODE
\documentclass[12pt]{article}
\title{Circular Diagram}
\date{}

\usepackage{smartdiagram}

\begin{document}
\maketitle

\begin{center}
\smartdiagram[circular diagram]{Item 1, Item 2, Item 3, Item 4}
\end{center}
\end{document}


This might be simple and effective but if it doesn't fit what you want you might also want to check out options to customize your own diagram. The specific options for this type of diagram also apply to the clockwise circular diagram, to the flow diagram and its horizontal counterpart. They are as follows: Now, let's try to make use of some of these options to make our diagram look even better:


CODE
\documentclass[12pt]{article}
\title{Customized Circular Diagram}
\date{}

\usepackage{smartdiagram}

\begin{document}
\maketitle

\begin{center}
\smartdiagramset{
module minimum width=4cm,
module minimum height=2cm,
font= \huge,
border color= black,
text color= blue!30!green,
circular distance= 5}
\smartdiagram[circular diagram]{Item 1, Item 2, Item 3, Item 4}
\end{center}

\end{document}


This diagram is compiled using a few of the previously listed options. We first begin the center environment to center the diagram in the middle of our document, then we define the settings of our diagram with the command \smartdiagram, we list the options we wish to modify taking them from the available ones and finally we draw our diagram with the \smartdiagram command. Take a look at the code above the pdf embed to get a grasp of how the options and diagrams should be built in LaTeX.
As you can see our options were typed out as they are, nothing fancy or complex needed. Just follow it with an "=" sign and you're set for building your own diagram. The circular diagram:clockwise works exactly the same, it only flips the arrow direction.
Flow Diagram
First of all the flow diagram makes use of 4 more options that you can apply: Here you can find the basic way LaTeX compiles a basic \smartdiagram[flow diagram] command:

CODE
\documentclass[12pt]{article}
\title{Flow Diagram}
\date{}

\usepackage{smartdiagram}
\begin{document}
\maketitle

\begin{center}
\smartdiagram[flow diagram]{Item 1, Item 2, Item 3, Item 4}
\end{center}

\end{document}


Likewise, we are now going to introduce options to make this default flow diagram our way:


CODE
\documentclass[12pt]{article}
\title{Customized Flow Diagram}
\date{}

\usepackage{smartdiagram}

\begin{document}
\maketitle

\begin{center}
\smartdiagramset{
uniform color list=black!50!white for 4 items,
module minimum width= 6cm,
module minimum height= 2cm,
module y sep= 3.5,
text color= blue,
font= \Large,
border color= red,
back arrow disabled= true}
\smartdiagram[flow diagram]{Item 1, Item 2, Item 3, Item 4}
\end{center}

\end{document}


We now used the additional flow diagram options to increase the vertical distance between modules and disable the back arrow that points back to the beginning of the diagram. Additionally we defined a uniform color for the first 4 items.
Constellation Diagram
Bubble and Constellation diagrams have a more complex set of options as they can be customized in more detail.
Here follows the list of new available options: Here follows a default Constellation Diagram:


CODE
\documentclass[12pt]{article}
\title{Constellation Diagram}
\date{}

\usepackage{smartdiagram}

\begin{document}
\maketitle

\begin{center}
\smartdiagram[constellation diagram]{Item 1, Item 2, Item 3, Item 4, Item 5}
\end{center}

\end{document}


And now will follow a customized constellation diagram:


CODE
\documentclass[12pt]{article}
\title{Customized Constellation Diagram}
\date{}

\usepackage{smartdiagram}

\begin{document}
\maketitle

\begin{center}
\smartdiagramset{
planet size= 4cm,
planet color= green,
planet font= \huge,
distance planet-connection= 0.1cm,
distance planet-text= 1cm,
satellite size= 2cm,
satellite font= \large,
satellite text opacity= 0.9,
distance satellite-connection= 0.1cm,
connection line width= 0.5cm,
distance planet-satellite= 5cm,
uniform connection color= true,
connection color= black}
\smartdiagram[constellation diagram]{Item 1, Item 2, Item 3, Item 4, Item 5}
\end{center}

\end{document}


Constellation diagrams are more complex as you can see from the length of the code, by using all of our options we managed to modify its default shape. Most commands like size, font, color we have already seen. What you should watch out for are the "distance" commands, those can get tricky if you miscalculate the space you're using.

Author's note: I'd reccomend not to mess too much with this diagram, it can get messy.

And here we conclude our brief introduction to SmartDiagram. You're welcome to keep reading this subsection of the Graphics section to find out how to draw with TikZ and PGFPlots.R