I have a flowchart created using tikz.
Example,
\documentclass[tikz, margin=3mm]{standalone}
\usetikzlibrary{backgrounds,
fit,
positioning}
\begin{document}
\begin{tikzpicture}[
node distance = 4mm and 4mm,
base/.style = {rectangle, draw, align=center},
steps/.style = {base, rounded corners, fill=gray!50,
minimum height=1cm, text width=3cm},
process/.style = {base,
minimum height=2cm, text width=4cm, fill=white}
]
\node (process1) [process] {text text};
\node (process2) [process, right=of process1] {text text
text text text text text text text text text text text text text text text text};
\node (process3) [process, right=of process2] {text text text};
\node (step1) [steps, above=of process1] {Step 1};
\node (step2) [steps, above=of process2] {Step 2};
\node (step3) [steps, above=of process3] {Step 3};
%
\scoped[on background layer]
{
\node[fit=(step1) (process1), fill=red!20] {};
\node[fit=(step2) (process2), fill=red!40] {};
\node[fit=(step3) (process3), fill=red!60] {};
}
\end{tikzpicture}
\end{document}
Could someone please let me know how the size of the figure created within \begin{tikzpicture}..\end{tikzpicture}
can be reduced to 0.8 of its original size?
EDIT:
I tried scale=0.8 and it didn't work for some reason.
EDIT2: I tried the below , but both scalebox and scale aren't working
\documentclass[]{article}
\usepackage{algorithmic}
\usepackage{graphicx}
\usepackage{tikz}
\usetikzlibrary{shapes.geometric,
arrows,
positioning,
arrows.meta,
backgrounds,
fit,
matrix}
% image
\usepackage{svg}
\usepackage{subfigure}
\usepackage{xcolor}
\usepackage{booktabs}
\usepackage{multirow}
\usepackage{siunitx}
% ----------------------------------------------------------------------------
\begin{document}
\begin{figure*}[!t]
\centering
% \scalebox{0.5}{
\begin{tikzpicture}[xscale=0.5, yscale=0.5,transform shape,
base/.style = {rectangle, draw, inner sep=2mm, align=center},
steps/.style = {base, rounded corners, fill=gray!50,
minimum height=1cm, text width=24mm}, % changed
process/.style = {base,
minimum height=3cm, text width=34mm, % changed
fill=white},
decision/.style = {diamond, minimum height=1cm ,
draw=black, fill=white,text width=24mm,
inner sep=2mm, align = center},
img/.style={inner sep=0pt,execute at begin node={%
\includegraphics[width=4cm,height=4cm]{#1}}},%added
>=Stealth
]
\matrix[matrix of nodes,column sep=1em,row sep=1em,nodes in empty cells,
nodes={anchor=center},
row 1/.style={nodes=steps,execute at begin node={Step \the\pgfmatrixcurrentcolumn}},
row 6/.style={nodes={text width=9em,align=center}}]
(mat) {
& & \\
|[process]| text1 &
|[process]| text2 &
|[process]| text3\\
|[img=im]| & |[img=im]| & |[img=im]| \\[1em]
|[img=im]| & |[process]| & |[img=im]| \\[1em]
|[img=im]| & |[img=im]| & |[img=im]| \\[-1em]
& & \\
};
\scoped[on background layer]
{\foreach \X [count=\Y] in {black!2,black!5,black!15} {
\node[fit=(mat-1-\Y) (mat-2-\Y) (mat-3-\Y) (mat-4-\Y) (mat-5-\Y) (mat-6-\Y), fill=\X]{};
}
}
\path[-Stealth]
(mat-2-1) edge (mat-2-2)
(mat-2-2) edge (mat-2-3)
(mat-3-1) edge (mat-4-1)
(mat-4-1) edge (mat-5-1)
(mat-5-1) edge (mat-5-2)
(mat-5-2) edge (mat-4-2)
(mat-4-2) edge (mat-3-2)
(mat-3-2) edge (mat-3-3)
(mat-3-3) edge (mat-4-3)
(mat-4-3) edge (mat-5-3);
\end{tikzpicture}
% }
\end{figure*}
\end{document}
Best Answer
If you want to control the size of such a figure when including it, you can use
standalone
andtikzscale
to include your example code (here saved underfigure.tex
) as a figure using the regular\includegraphics
. See below for an example:And the output: