"""Where the question lives: a field soil under a maize plant, as a schematic (the question has no data object). The plant stands on the soil surface (README.md: a wheat–maize field). Its roots, whose walls carry suberin, are the field colour; pollen grains, walled with sporopollenin, are sand: falling, lying on the surface and buried in the topsoil; faint crumbs are soil aggregates, some holding a root fragment or a grain (the "location in roots and soil aggregates" the question asks about). Not to scale: the grains are drawn far larger than they are. """ import math import random from pathlib import Path import kit rnd = random.Random(9) G, PX = 78, 320 # the soil surface, the plant roots, crumbs, grains = [], [], [] def root(x, y, ang, length, w, lateral=False): """A root as a curving polyline that sends out a few short laterals; ang is measured from straight down.""" pts, kids = [(x, y)], [] for k in range(int(length / 8)): ang += rnd.uniform(-.1, .1) + (.012 if ang < 0 else -.012) * (not lateral) x, y = x + 8 * math.sin(ang), y + 8 * math.cos(ang) if y > 254 or not 16 < x < 624: break pts.append((x, y)) if not lateral and k in (4, 8, 12, 16): kids.append((x, y, ang + (1 if k % 8 else -1) * rnd.uniform(.8, 1.1), rnd.uniform(26, 40), 2.2, True)) roots.append(kit.polyline(pts, 'f-s', w)) for c in kids: root(*c) for k in range(9): # nodal roots, fanning out from the stem base root(PX + (k - 4) * 2, G + 2, -1.36 + k * 0.34 + rnd.uniform(-.05, .05), rnd.uniform(190, 260), 3.6) # soil aggregates, some holding a root fragment (f) or a pollen grain (sand) for x, y, a, b, inside in ((70, 112, 20, 13, 'grain'), (150, 190, 22, 14, ''), (60, 222, 18, 12, ''), (214, 238, 19, 12, 'root'), (466, 236, 21, 13, ''), (552, 118, 19, 13, ''), (590, 206, 21, 13, 'grain'), (430, 120, 17, 11, ''), (236, 120, 17, 11, ''), (520, 172, 18, 12, 'root'), (110, 150, 16, 11, '')): t = rnd.uniform(-.3, .3) pts = [(x + a * math.cos(s) * math.cos(t) - b * math.sin(s) * math.sin(t) + rnd.uniform(-1.2, 1.2), y + a * math.cos(s) * math.sin(t) + b * math.sin(s) * math.cos(t) + rnd.uniform(-1.2, 1.2)) for s in [k * math.pi / 7 for k in range(14)]] crumbs.append(kit.polygon(pts, 'faint-s', ' stroke-width="2.2" stroke-linejoin="round"')) if inside == 'root': crumbs.append(kit.line(x - a * .5, y + 2, x + a * .5, y - 3, 'f-s', 3)) elif inside == 'grain': grains.append((x, y)) # the plant: a stalk running off the top, with long leaves arching from its nodes plant = [kit.line(PX, G, PX, 0, 'ink-s', 5.5)] for y, side, reach in ((62, -1, 150), (44, 1, 160), (24, -1, 170), (6, 1, 150)): plant.append(kit.path(f'M{PX},{y} C{PX + side * reach * .45},{y - 34} {PX + side * reach * .8},{y - 18} {PX + side * reach},{y + 16}', 'ink-s', 3.2)) # pollen: falling past the leaves, lying on the surface, buried in the topsoil, fewer deeper grains += [(120, 30), (212, 52), (436, 22), (536, 48), (70, G - 7), (186, G - 7), (402, G - 7), (604, G - 7), (160, 96), (270, 102), (380, 108), (488, 96), (300, 164)] pollen = [] for x, y in grains: pollen.append(kit.circle(x, y, 9, 'sand-s', ' stroke-width="2" stroke-dasharray="2.2 2.4"')) pollen.append(kit.circle(x, y, 5.5, 'sand')) body = crumbs + roots + [kit.line(14, G, 626, G, 'ink-s', 3)] + plant + pollen kit.write(__file__, 'life-health', ''.join(body), label='suberin roots and pollen walls in soil · schematic', title='A field soil under maize: suberin-walled roots, sporopollenin-walled pollen grains and soil aggregates')