9

I made this diagram in tikz

\begin{tikzpicture}[xscale=0.4,yscale=0.4]
\draw (0,4) -- (10,4); 
\draw (0,6) -- (10,6); 
\draw (8,4.75) -- (19.75,4.75) -- (19.75,-5.25); 
\draw (8,5.25) -- (20.25,5.25) -- (20.25,-5.25); 
\draw (0,4) .. controls (-1.3,4) and (-1.3,6) .. (0,6); 
\fill[black!20] (9,4.75) -- (12,4.75) -- (12,3.6) -- (9,4.25) -- (9,4.75); 
\fill[black!20] (9,5.25) -- (12,5.25) -- (12,6.4) -- (9,5.75) -- (9,5.25); 
\draw (21,3) -- (21,-7); 
\draw (19,3) -- (19,-7); 
\draw (19,-7) .. controls (19,-8.3) and (21,-8.3) .. (21,-7); 
\draw (19,0) -- (19.75,0); 
\draw (20.25,0) -- (21,0); 
\draw (-6,-18) rectangle (8,-17.5); 
\draw (-6,-17.5) -- (0.3, -16); 
\draw (0.3,-16) rectangle (1.7,-14); \draw (1,-15) circle (0.5); 
\draw (8,-17.5) -- (1.7,-16); 
\draw (0.5,-14) rectangle (1.5,0); 
\draw (0.5,0) .. controls (-1,0.5) and (1.1,2) .. (1,3); 
\draw (1.5,0) .. controls (3,0.5) and (0.9,2) .. (1,3); 
\end{tikzpicture}

Which produces this image enter image description here

How do I add black solids to the test tube above the flame of the bunsen burner? I want something like this:

enter image description here

Side note, this is similar to my previous question available here, but I decided to avoid the pslab package and just use tikz

2 Answers 2

14

Anyway, here is a TikZ proposal. Bonus: much easier to modify and much much lower compilation time, AND you could use @cfr's nice code for the flame ;-)

\documentclass[tikz,border=3.14mm,x11names,dvipsnames,svgnames]{standalone}
% from https://tex.stackexchange.com/a/372682/121799
\pgfdeclareradialshading[fradialcolour1,fradialcolour2,fradialcolour3]{fncyradial}{\pgfpoint{0}{0}}{% manual 1082-1083; later - shading is assumed to be 100bp diameter ??
  color(0)=(fradialcolour1);
  color(20bp)=(fradialcolour2);
  color(40bp)=(fradialcolour3);
  color(50bp)=(fradialcolour3)
}
\tikzset{%
  fradial/.code={%
        \tikzset{%
          fancy radial/.cd,
          shading=fncyradial,
          #1
        }
  },
  fancy radial/.search also={/tikz},
  fancy radial/.cd,
  fancy radial inner colour/.code={
        \colorlet{fradialcolour1}{#1}
  },
  fancy radial mid colour/.code={
        \colorlet{fradialcolour2}{#1}
  },
  fancy radial outer colour/.code={
        \colorlet{fradialcolour3}{#1}
  },
  fancy radial inner colour=black,
  fancy radial outer colour=black,
  fancy radial mid colour=white,
  inner color/.style={
        fancy radial inner colour=#1,
  },
  outer color/.style={
        fancy radial outer colour=#1,
  },
  mid color/.style={
        fancy radial mid colour=#1,
  },
}
\begin{document}
\begin{tikzpicture}[xscale=0.4,yscale=0.4]
\draw (0,4) -- (10,4); 
\draw (0,6) -- (10,6); 
\draw (8,4.75) -- (19.75,4.75) -- (19.75,-5.25); 
\draw (8,5.25) -- (20.25,5.25) -- (20.25,-5.25); 
\draw (0,4) .. controls (-1.3,4) and (-1.3,6) .. (0,6); 
\fill[black!20] (9,4.75) -- (12,4.75) -- (12,3.6) -- (9,4.25) -- (9,4.75); 
\fill[black!20] (9,5.25) -- (12,5.25) -- (12,6.4) -- (9,5.75) -- (9,5.25); 
\draw (21,3) -- (21,-7); 
\draw (19,3) -- (19,-7); 
\draw (19,-7) .. controls (19,-8.3) and (21,-8.3) .. (21,-7); 
\draw (19,0) -- (19.75,0); 
\draw (20.25,0) -- (21,0); 
\draw (-6,-18) rectangle (8,-17.5); 
\draw (-6,-17.5) -- (0.3, -16); 
\draw (0.3,-16) rectangle (1.7,-14); \draw (1,-15) circle (0.5); 
\draw (8,-17.5) -- (1.7,-16); 
\draw (0.5,-14) rectangle (1.5,0); 
\shade[fradial={inner color=Gold1, outer color=OrangeRed, 
mid color=BurntOrange}] (0.5,0) .. controls (-1,0.5) and (1.1,2) .. (1,3)
.. controls (0.9,2) and  (3,0.5) .. (1.5,0) -- cycle; 
%\draw (1.5,0) .. controls (3,0.5) and (0.9,2) .. (1,3); 
\foreach \X in {1,...,99}
{\fill (1.25+rand,{4.07+abs(rand*rand*rand*rand*rand*rand)}) circle (2pt);}
\end{tikzpicture}
\end{document}

enter image description here

For Sebastiano: moving flame and some Brownian motion ;-)

\documentclass[tikz,border=3.14mm,x11names,dvipsnames,svgnames]{standalone}
% from https://tex.stackexchange.com/a/372682/121799
\pgfdeclareradialshading[fradialcolour1,fradialcolour2,fradialcolour3]{fncyradial}{\pgfpoint{0}{0}}{% manual 1082-1083; later - shading is assumed to be 100bp diameter ??
  color(0)=(fradialcolour1);
  color(20bp)=(fradialcolour2);
  color(40bp)=(fradialcolour3);
  color(50bp)=(fradialcolour3)
}
\tikzset{%
  fradial/.code={%
        \tikzset{%
          fancy radial/.cd,
          shading=fncyradial,
          #1
        }
  },
  fancy radial/.search also={/tikz},
  fancy radial/.cd,
  fancy radial inner colour/.code={
        \colorlet{fradialcolour1}{#1}
  },
  fancy radial mid colour/.code={
        \colorlet{fradialcolour2}{#1}
  },
  fancy radial outer colour/.code={
        \colorlet{fradialcolour3}{#1}
  },
  fancy radial inner colour=black,
  fancy radial outer colour=black,
  fancy radial mid colour=white,
  inner color/.style={
        fancy radial inner colour=#1,
  },
  outer color/.style={
        fancy radial outer colour=#1,
  },
  mid color/.style={
        fancy radial mid colour=#1,
  },
}
\begin{document}
\foreach \X in {0,10,...,350}
{\begin{tikzpicture}[xscale=0.4,yscale=0.4]
\draw (0,4) -- (10,4); 
\draw (0,6) -- (10,6); 
\draw (8,4.75) -- (19.75,4.75) -- (19.75,-5.25); 
\draw (8,5.25) -- (20.25,5.25) -- (20.25,-5.25); 
\draw (0,4) .. controls (-1.3,4) and (-1.3,6) .. (0,6); 
\fill[black!20] (9,4.75) -- (12,4.75) -- (12,3.6) -- (9,4.25) -- (9,4.75); 
\fill[black!20] (9,5.25) -- (12,5.25) -- (12,6.4) -- (9,5.75) -- (9,5.25); 
\draw (21,3) -- (21,-7); 
\draw (19,3) -- (19,-7); 
\draw (19,-7) .. controls (19,-8.3) and (21,-8.3) .. (21,-7); 
\draw (19,0) -- (19.75,0); 
\draw (20.25,0) -- (21,0); 
\draw (-6,-18) rectangle (8,-17.5); 
\draw (-6,-17.5) -- (0.3, -16); 
\draw (0.3,-16) rectangle (1.7,-14); \draw (1,-15) circle (0.5); 
\draw (8,-17.5) -- (1.7,-16); 
\draw (0.5,-14) rectangle (1.5,0); 
\shade[fradial={inner color=Gold1, outer color=OrangeRed, 
mid color=BurntOrange}] (0.5,0) .. controls ({-1+0.2*sin(\X+60*rand)},{0.5+0.2*cos(\X+60*rand)}) and 
({1.1+0.2*sin(\X+60*rand)},{2+0.2*cos(\X+60*rand)}) .. (1,{3+0.2*cos(\X+60*rand)})
.. controls ({0.9+0.2*sin(\X+60*rand)},{2+0.2*cos(\X+60*rand)}) and  ({3+0.2*sin(\X+60*rand)},{0.5+0.2*cos(\X+60*rand)}) .. (1.5,0) -- cycle; 
%\draw (1.5,0) .. controls (3,0.5) and (0.9,2) .. (1,3); 
\foreach \X in {1,...,99}
{\fill (1.25+rand,{4.07+abs(rand*rand*rand*rand*rand*rand)}) circle (2pt);}
\end{tikzpicture}}
\end{document}

enter image description here

5
  • 3
    But if the flame moves, the figure is even more beautiful. :-)
    – Sebastiano
    Commented Jul 19, 2018 at 7:30
  • 1
    @Sebastiano You're right. I updated. ;-)
    – user121799
    Commented Jul 19, 2018 at 7:40
  • 1
    ahahahah. Excellent very very execellent.
    – Sebastiano
    Commented Jul 19, 2018 at 7:42
  • 1
    +1 Love the Brownian motion!
    – user30471
    Commented Jul 19, 2018 at 8:02
  • Damn, already upvoted before your edit. Vote to make it possible to upvote edits separately.
    – Max
    Commented Jul 19, 2018 at 8:10
10

Nice drawing! Perhaps something like this:

enter image description here

I have only added three "solids" but this should be OK for proof-of-concept. For good measure I have also tilted the test tube and put the flame over the top.

Here's the modified code:

\documentclass{article}
\usepackage{tikz}
\begin{document}

\begin{tikzpicture}[xscale=0.4,yscale=0.4]
  \begin{scope}[rotate=30,xshift=18mm,yshift=-34mm]
    \draw (0,4) -- (10,4);
    \draw (0,6) -- (10,6);
    \draw (8,4.75) -- (19.75,4.75) -- (19.75,-5.25);
    \draw (8,5.25) -- (20.25,5.25) -- (20.25,-5.25);
    \foreach \pt/\r in {(1,5)/2, (0.5,4.5)/1.5, (-0.5,5)/2.6} {
       \filldraw[black] \pt circle [radius=\r mm];
    }
    \draw (0,4) .. controls (-1.3,4) and (-1.3,6) .. (0,6);
    \fill[black!20] (9,4.75) -- (12,4.75) -- (12,3.6) -- (9,4.25) -- (9,4.75);
    \fill[black!20] (9,5.25) -- (12,5.25) -- (12,6.4) -- (9,5.75) -- (9,5.25);
    \draw (21,3) -- (21,-7);
    \draw (19,3) -- (19,-7);
    \draw (19,-7) .. controls (19,-8.3) and (21,-8.3) .. (21,-7);
    \draw (19,0) -- (19.75,0);
    \draw (20.25,0) -- (21,0);
  \end{scope}
  \draw (-6,-18) rectangle (8,-17.5);
  \draw (-6,-17.5) -- (0.3, -16);
  \draw (0.3,-16) rectangle (1.7,-14); \draw (1,-15) circle (0.5);
  \draw (8,-17.5) -- (1.7,-16);
  \draw (0.5,-14) rectangle (1.5,0);
  \draw[fill=white] (0.5,0) .. controls (-1,0.5) and (1.1,2) .. (1,3)
                            .. controls (0.9,2) and (3,0.5)  .. (1.5,0);
\end{tikzpicture}

\end{document}

Edit

Marmot inspired random solids:

enter image description here

\documentclass{article}
\usepackage{tikz}
\begin{document}

\begin{tikzpicture}[scale=0.3]
  \begin{scope}[rotate=30,xshift=18mm,yshift=-34mm]
    \draw (0,4) -- (10,4);
    \draw (0,6) -- (10,6);
    \draw (8,4.75) -- (19.75,4.75) -- (19.75,-5.25);
    \draw (8,5.25) -- (20.25,5.25) -- (20.25,-5.25);
    \foreach \pt in {1,...,40} {
       \pgfmathparse{(2*rnd)}
       \draw[fill=black] (rand+0.4,5+0.8*rand) circle [radius=1.2mm];
    }
    \draw (0,4) .. controls (-1.3,4) and (-1.3,6) .. (0,6);
    \fill[black!20] (9,4.75) -- (12,4.75) -- (12,3.6) -- (9,4.25) -- (9,4.75);
    \fill[black!20] (9,5.25) -- (12,5.25) -- (12,6.4) -- (9,5.75) -- (9,5.25);
    \draw (21,3) -- (21,-7);
    \draw (19,3) -- (19,-7);
    \draw (19,-7) .. controls (19,-8.3) and (21,-8.3) .. (21,-7);
    \draw (19,0) -- (19.75,0);
    \draw (20.25,0) -- (21,0);
  \end{scope}
  \draw (-6,-18) rectangle (8,-17.5);
  \draw (-6,-17.5) -- (0.3, -16);
  \draw (0.3,-16) rectangle (1.7,-14); \draw (1,-15) circle (0.5);
  \draw (8,-17.5) -- (1.7,-16);
  \draw (0.5,-14) rectangle (1.5,0);
  \draw[fill=white] (0.5,0) .. controls (-1,0.5) and (1.1,2) .. (1,3)
                            ..  controls (0.9,2) and (3,0.5)  .. (1.5,0);
\end{tikzpicture}

\end{document}

You must log in to answer this question.

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