使用 TikZ 绘制浮游生物

使用 TikZ 绘制浮游生物

有人能建议一种使用 TikZ 绘制随机浮游生物群落的方法吗?类似于

图像

我知道可以保存图像然后将其加载到 LaTeX 中,但我希望有一种单独绘制它们的方法。

答案1

或者,您可以使用 pgf 3.0.0 和pic语法。

\documentclass[border=0.12cm,tikz]{standalone}
\usetikzlibrary{decorations.pathmorphing}
\begin{document}

\tikzset{%
  plankton 1/.pic={
    \fill [green!20!brown]        
     \foreach \i in {1,2,3}{
       [rotate=\i*120]  (0,1.125) ellipse [x radius=.5, y radius=1]
     };
    \clip [preaction={fill=blue!60}]
      circle [radius=1.125];
    \foreach \i in {1,...,50}
      \fill [blue!70] (rnd*360:rnd*1.125)
        circle [radius=0.125]; 
  },
  plankton 2/.pic={
    \draw [thick, line cap=round, black!80]
      (-0.125,2) to [bend right] ++(120:1.125)
      ( 0.125,2) to [bend left]  ++(60:1.125)
      (-0.125,0) to [bend left]  ++(240:1)
      ( 0.125,0) to [bend right] ++(300:1);
    \foreach \i [evaluate={\l=2+\i/4;}] in {1,...,4}
      \draw [black!80]
        (-0.125,\i/8) to [bend right, out=270, in=270, looseness=\l] (0,1+\i/4)
        (-0.125,\i/8) to [bend right, out=90,  in=90,  looseness=\l] (0,1+\i/4);
     \foreach \i [evaluate={\j=mod(\i,2)*10+10;}] in {1,...,8}
      \fill [green!\j!brown] (0,\i/4) 
        ellipse [x radius=(4+\i)/16, y radius=0.25]; 
  },
  plankton 3/.pic={
    \fill [green!20!brown]
      ellipse [x radius=0.25, y radius=1];
    \fill [green!10!brown]
      ellipse [x radius=0.25, y radius=0.5];
    \draw [thick, black, line cap=round]
     (-0.5,-2) to [bend right, looseness=.5] (-0.5,2)
     ( 0.5,-2) to [bend left,  looseness=.5] ( 0.5,2);
  }
}
\begin{tikzpicture}[x=5pt,y=5pt]
\fill [blue!20]
  (0,0) -- (55,0) -- (55,10)
    decorate [decoration={snake, segment length=1cm, amplitude=.125cm}] 
   { -- (0,10) } -- cycle;
\foreach \i [evaluate={\p=int(random(1,3))}] in {1,...,10}
\path (\i*5, rnd*5+2.5) pic [rotate=rnd*360] {plankton \p};

\end{tikzpicture}

\end{document}

在此处输入图片描述

答案2

嗯,这是A浮游生物。有人想吃蟹黄堡吗?

\documentclass[border=0.12cm,tikz]{standalone}
\begin{document}
\begin{tikzpicture}[x=5pt,y=5pt]
\definecolor{feelers}{rgb}{0.12, 0.41, 0.15}
\definecolor{plankton}{rgb}{0.57, 0.76, 0.66}

\path [line width=8, fill=feelers, draw=black]  (32.58,159.92)
  .. controls (32.58,159.92) and (20.61,184.16) .. (16.15,201.98)
  .. controls (11.69,219.81) and ( 7.24,246.54) .. ( 6.40,257.41)
  .. controls ( 5.57,268.27) and ( 6.68,303.08) .. ( 8.63,312.27)
  .. controls (10.58,321.46) and (13.36,327.31) .. (13.36,327.31)
  .. controls (13.36,327.31) and ( 8.63,304.47) .. ( 8.07,296.68)
  .. controls ( 7.51,288.88) and ( 6.40,261.86) .. ( 8.35,250.72)
  .. controls (10.30,239.58) and (18.10,200.59) .. (28.68,182.21)
  .. controls (39.27,163.82) and (40.10,164.38) .. (40.10,164.38)
  -- cycle;

\path [fill=black]  ( 6.68,206.71)
  -- (22.28,212.01) -- (23.67,208.94)
  -- ( 8.35,202.82) -- cycle
  %
  ( 3.34,229.83)
  -- (16.15,234.01) -- (17.54,229.83)
  -- ( 4.45,226.21) -- cycle
  %
  ( 0.83,256.85)
  -- (11.97,257.68) -- (12.53,255.18)
  -- (0,254.90) -- cycle
  %
  ( 0.27,287.21)
  -- (11.69,286.65) -- (11.69,283.59)
  -- ( 0.83,283.59) -- cycle;

\path [draw=black, line width=8, fill=plankton]  (24.94,83.99)
  .. controls (24.94,83.99) and (22.96,126.14) .. (24.83,139.12)
  .. controls (26.46,150.34) and (31.37,173.15) .. (52.25,172.35)
  .. controls (68.73,171.71) and (80.36,160.70) .. (79.56,134.59)
  .. controls (78.65,104.85) and (80.77,91.62) .. (80.77,91.62)
  .. controls (80.77,91.62) and (97.23,86.00) .. (100.85,78.77)
  .. controls (104.46,71.54) and (100.04,70.34) .. (95.63,66.32)
  .. controls (91.21,62.31) and (88.00,61.90) .. (88.00,61.90)
  .. controls (88.00,61.90) and (90.40,61.90) .. (92.41,58.29)
  .. controls (94.42,54.67) and (88.40,53.47) .. (86.39,55.48)
  .. controls (84.38,57.49) and (82.58,57.61) .. (82.37,59.49)
  .. controls (81.99,62.96) and (83.98,64.31) .. (88.00,68.33)
  .. controls (93.48,73.81) and (94.82,75.96) .. (89.60,78.77)
  .. controls (84.38,81.58) and (80.36,83.99) .. (80.36,83.99)
  .. controls (80.36,83.99) and (85.18,53.07) .. (87.19,43.43)
  .. controls (89.20,33.79) and (86.39,28.97) .. (86.39,28.97)
  .. controls (86.39,28.97) and (89.60,25.76) .. (94.42,20.54)
  .. controls (99.24,15.32) and (100.44, 7.69) .. (96.43,10.50)
  .. controls (92.41,13.31) and (80.36,24.55) .. (80.36,24.55)
  -- (82.77,22.55)
  .. controls (82.77,22.55) and (71.13,18.53) .. (65.51,18.93)
  .. controls (59.88,19.33) and (56.27,20.94) .. (56.27,20.94)
  -- (58.14,20.08)
  .. controls (58.14,20.08) and (58.28,17.73) .. (57.87,12.10)
  .. controls (57.47, 6.48) and (58.40,-4.30) .. (54.66, 4.07)
  .. controls (51.29,11.63) and (50.24,24.96) .. (50.24,24.96)
  .. controls (50.24,24.96) and (34.98,46.64) .. (33.78,55.88)
  .. controls (32.57,65.12) and (27.75,75.16) .. (27.75,75.16)
  -- (16.11,68.73)
  -- (18.52,70.34)
  .. controls (18.52,70.34) and (24.14,66.32) .. (28.16,64.31)
  .. controls (32.17,62.31) and (35.38,58.69) .. (32.98,55.88)
  .. controls (30.57,53.07) and (20.93,51.86) .. (24.14,55.88)
  .. controls (27.35,59.90) and (27.35,60.70) .. (27.35,60.70)
  .. controls (27.35,60.70) and (14.10,60.30) .. (10.89,65.92)
  .. controls ( 7.67,71.54) and (11.29,73.15) .. (16.91,76.76)
  .. controls (22.53,80.38) and (24.94,83.99) .. (24.94,83.99)
  -- cycle;

\path [line width=4,draw=black,fill=white]  (39.33,69.44)
  .. controls (39.33,69.44) and (52.59,68.07) .. (59.75,71.73)
  .. controls (66.92,75.39) and (73.47,83.31) .. (73.47,83.31)
  .. controls (73.47,83.31) and (73.93,66.24) .. (71.49,62.43)
  .. controls (69.05,58.62) and (64.94,54.04) .. (57.77,52.98)
  .. controls (50.61,51.91) and (44.51,55.11) .. (44.51,55.11)
  -- (47.86,53.44)
  .. controls (47.86,53.44) and (48.78,59.69) .. (47.86,63.19)
  .. controls (46.95,66.70) and (46.34,69.14) .. (46.34,69.14)
  -- cycle;

\path [draw=black, line width=4]  (68.90,85.29)
  .. controls (68.90,85.29) and (71.65,85.45) .. (73.47,83.77)
  .. controls (75.30,82.09) and (76.07,80.57) .. (76.07,80.57)
  %
  (48.63,61.21)
  .. controls (48.63,61.21) and (56.25,61.06) .. (61.74,63.19)
  .. controls (67.22,65.33) and (73.02,68.53) .. (73.02,68.53)
  %
  (52.90,69.59)
  .. controls (52.90,69.59) and (53.96,64.26) .. (54.57,60.75)
  .. controls (55.18,57.25) and (55.49,52.52) .. (55.49,52.52)
  %
  (59.60,71.42)
  .. controls (59.60,71.42) and (61.28,66.24) .. (61.89,62.58)
  .. controls (62.50,58.92) and (63.57,54.81) .. (63.57,54.81)
  %
  (66.31,75.84)
  -- (69.51,59.99);

\path [draw=black, line width=4,fill=yellow!20]  (52.29,122.03)
  -- (34.45,113.04)
  .. controls (34.45,113.04) and (36.58,97.79) .. (39.94,92.00)
  .. controls (43.29,86.21) and (46.65,81.94) .. (51.68,81.94)
  .. controls (56.71,81.94) and (61.89,85.75) .. (64.18,93.83)
  .. controls (66.46,101.91) and (65.85,119.59) .. (65.85,119.59)
  -- cycle;

\path [current path/.try, fill=orange!35!red]  (60.67,106.64)
  .. controls (60.67,99.90) and (56.10,94.44) .. (50.46,94.44)
  .. controls (44.82,94.44) and (40.24,99.90) .. (40.24,106.64)
  .. controls (40.24,113.37) and (44.82,118.83) .. (50.46,118.83)
  .. controls (56.10,118.83) and (60.67,113.37) .. (60.67,106.64)
  -- cycle;

\path [fill=white]  (54.11,108.16)
  .. controls (54.11,104.62) and (51.90,101.76) .. (49.16,101.76)
  .. controls (46.42,101.76) and (44.21,104.62) .. (44.21,108.16)
  .. controls (44.21,111.70) and (46.42,114.56) .. (49.16,114.56)
  .. controls (51.90,114.56) and (54.11,111.70) .. (54.11,108.16)
  -- cycle;

\path [draw=black, line width=4, fill=plankton]  (62.96,121.27)
  .. controls (62.96,121.27) and (66.00,123.25) .. (67.53,120.81)
  .. controls (69.05,118.37) and (59.45,113.04) .. (51.22,112.43)
  .. controls (42.99,111.82) and (32.16,112.12) .. (31.71,114.56)
  .. controls (31.25,117.00) and (34.45,118.07) .. (34.45,118.07)
  .. controls (34.45,118.07) and (34.45,129.20) .. (39.02,135.75)
  .. controls (43.60,142.31) and (46.19,143.68) .. (50.91,142.31)
  .. controls (55.64,140.94) and (59.60,136.67) .. (62.80,130.11)
  .. controls (66.00,123.56) and (65.85,121.88) .. (65.85,121.88)
  -- cycle;


\path [draw=black, line width=4]  (38.72,117.15)
  .. controls (38.72,117.15) and (40.70,116.54) .. (43.60,116.70)
  .. controls (46.49,116.85) and (47.71,116.85) .. (47.71,116.85);

\path [fill=black]  (31.27,152.90)
  .. controls (31.27,152.90) and (33.93,159.81) .. (46.87,159.91)
  .. controls (59.81,160.01) and (64.74,151.32) .. (64.74,151.32)
  .. controls (64.74,151.32) and (64.05,149.25) .. (65.34,148.16)
  .. controls (66.62,147.08) and (66.52,145.10) .. (66.52,145.10)
  -- (63.95,146.19)
  .. controls (63.95,146.19) and (63.36,145.20) .. (64.65,144.01)
  .. controls (65.93,142.83) and (65.53,141.74) .. (65.53,141.74)
  .. controls (65.53,141.74) and (59.71,149.45) .. (51.91,148.95)
  .. controls (44.11,148.46) and (36.60,144.51) .. (36.60,144.51)
  .. controls (36.60,144.51) and (36.90,146.29) .. (38.18,147.57)
  .. controls (39.46,148.85) and (39.66,149.15) .. (39.66,149.15)
  -- (33.93,148.66)
  .. controls (33.93,148.66) and (34.72,150.93) .. (36.01,151.72)
  .. controls (37.29,152.51) and (37.69,153.00) .. (37.69,153.00)
  -- cycle;

\path [fill=black]  (41.04,161.79)
  .. controls (41.04,161.79) and (42.23,167.52) .. (50.33,167.62)
  .. controls (58.42,167.71) and (61.29,160.70) .. (61.29,160.70)
  .. controls (61.29,160.70) and (58.82,164.95) .. (50.23,164.95)
  .. controls (41.64,164.95) and (41.04,161.79) .. (41.04,161.79)
  -- cycle;

\path [line width=8,draw=black,fill=feelers]  (62.97,168.01)
  .. controls (62.97,168.01) and (65.04,207.51) .. (69.19,220.74)
  .. controls (73.34,233.98) and (76.89,252.54) .. (84.59,268.74)
  .. controls (92.30,284.93) and (100.00,300.14) .. (105.13,307.84)
  .. controls (110.27,315.55) and (130.02,339.05) .. (130.02,339.05)
  .. controls (130.02,339.05) and (110.80,312.47) .. (102.76,298.96)
  .. controls (94.67,285.33) and (90.12,273.48) .. (85.78,263.60)
  .. controls (82.65,256.50) and (79.22,240.88) .. (76.50,227.66)
  .. controls (73.73,214.23) and (72.94,200.60) .. (72.15,182.03)
  .. controls (71.36,163.47) and (70.97,161.30) .. (70.97,161.30);


\path [fill=black]  
  (64.65,226.08)
  -- (64.65,221.14) -- (80.25,220.15)
  -- (80.05,224.50) -- cycle
  %
  (71.36,250.37)
  -- (85.38,247.01) -- (84.59,243.06)
  -- (70.57,246.82) -- cycle
  %
  (82.42,279.01)
  -- (94.27,273.08) -- (93.09,269.33)
  -- (81.24,274.66) -- cycle
  %
 (96.84,305.87)
  -- (107.90,300.73) -- (106.52,297.18)
  -- (95.06,303.89)  -- cycle;


\end{tikzpicture}

\end{document}

在此处输入图片描述

相关内容