
Sou novo no tikz, encontrei esse código off-line, mas tenho experiência mínima com codificação. Quero ter cinco frascos seguidos com setas apontando na mesma direção em direção aos frascos. Além disso, gostaria de adicionar medidas de volume.
\documentclass[margin=10pt]{standalone}
\usepackage{tikz}
\usetikzlibrary{calc, shadings, arrows.meta}
\definecolor{tappo}{RGB}{148,154,110}
\definecolor{lightblue}{RGB}{155,210,220}
\tikzset{
arrR/.style={-Latex},
arrL/.style={Latex-}
}
\newcommand\flask[4][arrR]{%
\begin{scope}[shift={(#2)}]
\draw[gray] (-1.8,0) arc (180:0:1.8cm and 6mm);
\begin{scope}
\clip[rounded corners=5mm] (-.5,5) -- (-.5,3.5) -- (-1.8,.5) [sharp corners]-- (-1.8,0) arc (180:360:1.8cm and 6mm) [rounded corners=5mm]-- (1.8,.5) -- (.5,3.5) [sharp corners]-- (.5,5) -- cycle;
\end{scope}
\draw[right color=tappo, left color=tappo, middle color=tappo!40] (.4,4.5) -- (.6,5.5) arc (0:180:6mm and 2mm) -- (-.4,4.5) arc (180:360:4mm and 2mm);
\draw[fill=tappo!60] (0,5.5) ellipse (6mm and 2mm);
\draw[fill=lightblue,rounded corners=5mm, fill opacity=.7] (-.5,5) -- (-.5,3.5) -- (-1.8,.5) [sharp corners]-- (-1.8,0) arc (180:360:1.8cm and 6mm) [rounded corners=5mm]-- (1.8,.5) -- (.5,3.5) [sharp corners]-- (.5,5) arc (360:180:5mm and 2mm);
\draw[fill=lightblue, opacity=.5] (.5,5) to[out=-50,in=230, looseness=2] (-.5,5) arc (180:360:5mm and 2mm);
\begin{scope}[remember picture,overlay,shift={(0,7.5)},rotate=210-(#3*.16)]
\filldraw[black] (-.2,.03) --++ (1,-.01) --++ (0,-.04) --++ (-1,-.01) --++ (0,-.08) --++ (-.05,0) --++ (0,.22) --++ (.05,0) -- cycle;
\end{scope}
\begin{scope}
\draw[#1, line width=.2mm] (1.5,3.9) -- (2.5,3.9) node[right, font=\scriptsize] {#4};
\end{scope}
\begin{scope}[xshift=4mm]
\end{scope}
\end{scope}
}
\begin{document}
\begin{tikzpicture}
\flask{0,0}{0}{1 Molar};
\flask[arrL]{5,0}{130}{0.5 Molar};
\flask[arrL]{10,0}{590}{0.125 Molar};
\end{tikzpicture}
\end{document}
Responder1
Bem-vindo ao TeX:SE!
Em seu MWE (exemplo mínimo de trabalho) estão três frascos desenhados com o seguinte fragmento de código:
\flask{0,0}{0}{1 Molar};
\flask[arrL]{5,0}{130}{0.5 Molar};
\flask[arrL]{10,0}{590}{0.125 Molar};
Se você quiser ter mais deles, basta adicionar mais linhas de código com a distância horizontal desejada entre seus centros. Por exemplo:
\flask{0,0}{0}{1 Molar};
\flask[arrL]{5,0}{130}{0.5 Molar};
\flask[arrL]{10,0}{590}{0.125 Molar};
\flask[arrL]{15,0}{590}{0.125 Molar};
\flask[arrL]{20,0}{590}{0.125 Molar};
Com esta distância, a imagem sairá da página. Para evitar isso, você precisa reduzir as distâncias de acordo. Por exemplo, como é feito no seguinte WME:
\documentclass[margin=10pt]{standalone}
\usepackage{tikz}
\usetikzlibrary{arrows.meta,
calc,
shadings}
\definecolor{tappo}{RGB}{148,154,110}
\definecolor{lightblue}{RGB}{155,210,220}
\tikzset{
arrR/.style={-Latex},
arrL/.style={Latex-}
}
\newcommand\flask[4][arrR]{%
\begin{scope}[shift={(#2)}]
\draw[gray] (-1.8,0) arc (180:0:1.8cm and 6mm);
\begin{scope}
\clip[rounded corners=5mm] (-.5,5) -- (-.5,3.5) -- (-1.8,.5) [sharp corners] -- (-1.8,0) arc (180:360:1.8cm and 6mm) [rounded corners=5mm]-- (1.8,.5) -- (.5,3.5) [sharp corners]-- (.5,5) -- cycle;
\end{scope}
\draw[right color=tappo, left color=tappo, middle color=tappo!40] (.4,4.5) -- (.6,5.5) arc (0:180:6mm and 2mm) -- (-.4,4.5) arc (180:360:4mm and 2mm);
\draw[fill=tappo!60] (0,5.5) ellipse (6mm and 2mm);
\draw[fill=lightblue,rounded corners=5mm, fill opacity=.7] (-.5,5) -- (-.5,3.5) -- (-1.8,.5) [sharp corners]-- (-1.8,0) arc (180:360:1.8cm and 6mm) [rounded corners=5mm]-- (1.8,.5) -- (.5,3.5) [sharp corners]-- (.5,5) arc (360:180:5mm and 2mm);
\draw[fill=lightblue, opacity=.5] (.5,5) to[out=-50,in=230, looseness=2] (-.5,5) arc (180:360:5mm and 2mm);
\begin{scope}[remember picture,overlay,shift={(0,7.5)},rotate=210-(#3*.16)]
\filldraw[black] (-.2,.03) --++ (1,-.01) --++ (0,-.04) --++ (-1,-.01) --++ (0,-.08) --++ (-.05,0) --++ (0,.22) --++ (.05,0) -- cycle;
\end{scope}
\begin{scope}
\draw[#1, line width=.2mm] (1,3.9) -- (2,3.9) node[right, font=\scriptsize] {#4};
\end{scope}
\end{scope}
}
\begin{document}
\begin{tikzpicture}
\flask{0,0}{0}{1 Molar};
\flask[arrL]{4.2,0}{130}{0.5 Molar}; % <--- changed
\flask[arrL]{8.4,0}{590}{0.125 Molar}; % <--- changed
\flask[arrR]{12.6,0}{590}{0.125 Molar}; % <--- added
\flask[arrL]{16.8,0}{590}{0.125 Molar}; % <--- added
\end{tikzpicture}
\end{document}
Responder2
Esse é um frasco muito bom! O problema é que ele não escala bem por causa do rounded corners
. E cinco deles não cabem em uma página. Portanto, use \scalebox
e desenhe as setas usando LaTeX
comandos comuns. Nota: adicionei algumas medidas de volume ao frasco.
Criei um novo comando \scaleflask
que aceita um argumento opcional.
\scaleflask[.3]
.3
é o fator de escala (opcional) (padrão=1).
O código
\[
\scaleflask[.3]\xleftarrow{\textstyle1.0\Molar}
\scaleflask[.3]\xleftarrow{\textstyle0.5\Molar}
\scaleflask[.3]\xleftarrow{\textstyle0.25\Molar}
\scaleflask[.3]\xleftarrow{\textstyle0.13\Molar}
\scaleflask[.3]\xleftarrow{\textstyle0.06\Molar}
\]
cria a imagem acima. Aqui está o código completo:
\documentclass{article}
\usepackage{tikz, amsmath}
\usetikzlibrary{shadings}
\definecolor{tappo}{RGB}{148,154,110}
\definecolor{lightblue}{RGB}{155,210,220}
\newcommand\flask[1][1]{\begin{tikzpicture}
\draw[gray] (-1.8,0) arc (180:0:1.8cm and 6mm);
\begin{scope}
\clip[rounded corners=5mm] (-.5,5) -- (-.5,3.5) -- (-1.8,.5) [sharp corners]--
(-1.8,0) arc (180:360:1.8cm and 6mm) [rounded corners=5mm]-- (1.8,.5) --
(.5,3.5) [sharp corners]-- (.5,5) -- cycle;
\end{scope}
\draw[right color=tappo, left color=tappo, middle color=tappo!40] (.4,4.5) --
(.6,5.5) arc (0:180:6mm and 2mm) -- (-.4,4.5) arc (180:360:4mm and 2mm);
\draw[fill=tappo!60] (0,5.5) ellipse (6mm and 2mm);
\draw[fill=lightblue,rounded corners=5mm, fill opacity=.7] (-.5,5) -- (-.5,3.5) --
(-1.8,.5) [sharp corners]-- (-1.8,0) arc (180:360:1.8cm and 6mm) [rounded corners=5mm]--
(1.8,.5) -- (.5,3.5) [sharp corners]-- (.5,5) arc (360:180:5mm and 2mm);
\draw[fill=lightblue, opacity=.5] (.5,5) to[out=-50,in=230, looseness=2] (-.5,5) arc (180:360:5mm and 2mm);
\foreach \y[count=\n, evaluate=\n as \m using int(50*\n), evaluate=\y as \k using 18-\y^(3/2)/14] in {4,10,17,25}{
\draw[white, thick, yshift=\y mm]([xscale=3]250:.333*\k mm) arc(250:280:\k mm and .333*\k mm)node[rotate=4, right]{\sffamily \m};}
\end{tikzpicture}}
\newcommand{\scaleflask}[1][1]{\vcenter{\hbox{\scalebox{#1}{\flask}}}}
\newcommand{\Molar}{\textup{ Molar}}
\begin{document}
\[
\scaleflask[.3]\xleftarrow{\textstyle1.0\Molar}
\scaleflask[.3]\xleftarrow{\textstyle0.5\Molar}
\scaleflask[.3]\xleftarrow{\textstyle0.25\Molar}
\scaleflask[.3]\xleftarrow{\textstyle0.13\Molar}
\scaleflask[.3]\xleftarrow{\textstyle0.06\Molar}
\]
\end{document}