  Recent studies have shown that the radii and masses of adjacent planets
within a planetary system are correlated. It is unknown how this
'peas-in-a-pod' phenomenon originates, whether it is in place at birth or
requires evolution, and whether it (initially) applies only to neighboring
planets or to all planets within a system. Here we address these questions by
making use of the recent discovery that planetary system architectures strongly
depend on ambient stellar clustering. Based on Gaia's second data release, we
divide the sample of planetary systems hosting multiple planets into those
residing in stellar position-velocity phase space overdensities and the field,
representing samples with elevated and low degrees of external perturbation,
respectively. We demonstrate that the peas-in-a-pod phenomenon manifests itself
in both samples, suggesting that the uniformity of planetary properties within
a system is not restricted to direct neighbors and likely already exists at
birth. The radius uniformity is significantly elevated in overdensities,
suggesting that it can be enhanced by evolutionary effects that either have a
similar impact on the entire planetary system or favour the retention of
similar planets. The mass uniformity may exhibit a similar, but weaker
dependence. Finally, we find ordering in both samples, with the planet radius
and mass increasing outwards. Despite its prevalence, the ordering is somewhat
weaker in overdensities, suggesting that it may be disrupted by external
perturbations arising from stellar clustering. We conclude that a comprehensive
understanding of the 'peas-in-a-pod' phenomenon requires linking planet
formation and evolution to the large-scale stellar and galactic environment.
