Integration of community ecology with disease biology is viewed as a promising avenue for uncovering determinants of pathogen diversity, and for predicting disease risks. Plant-infecting viruses represent a vastly underestimated component of biodiversity with potentially important ecological and evolutionary roles. We performed hierarchal spatial analysis of wild plant populations to characterise the diversity and coexistence structure of within-host virus communities, and their predictors. Our results show that these virus communities are characterised by single infections of few, dominating virus taxa as well as diverse, non-random coinfections. Using a novel graphical modelling framework we demonstrate that after accounting for environmental heterogeneity at the level of both individual host plants and populations, most virus co-occurrence patterns can be attributed to virus-virus associations. Moreover, we show that conditioning variables changed virus association networks especially through their indirect effects. This highlights a previously underestimated mechanism of how human-driven environmental change can influence disease risks.