Some plants need extra metals in the soil to survive. They are called, quite logically, metallophytes. Others can take or leave the metals. and they are called, more dubiously, pseudometallophytes. Either way the plant excludes or accumulates the metal, although mostly the pseduometallophytes exclude and the metallophytes accumulate.
While I was in the UK earlier this year I took an overnight trip to Durham. I was there to help with a freshwater algal identification course but along the way I saw a whole lot of metallophytes and pseudometallophytes in the tailings from the mining of lead and other minerals in the West Pennines.
The metal tolerant plants are spread across 34 or so families but Brassicaceae, the cabbage family, is commonly represented. This Arabidopsis haleri was the most commonly encountered Brassicaceae I noticed in the West Pennines.
Like plants living in very salty soils, some (pseudo)metallophytes excrete the metal through glands and hairs. At least some forms of the pansy illustrated at the top of this post, Viola tricolor, are known to to accumulate metals in their hairs and then shed them. So they kind of accumulate then exclude.
Elsewhere (pseudo)metallphytes are being used to not only restore vegetation after mining, such as Pig Face (Carpobrotus rossii) to clean up cadmium in Australia, but sometimes to prospect for metals like gold.
One day we might even be able to harvest rather than mine our metals. Earlier this year New Scientist journalist Katia Moskvitch reported on attempts to extend decontamination of a nickel-rich site to extracting the metal from a species of Alyssum (a Brassicaceae). The plants concentrate the metal in their leaves, which are harvested and burnt, with the ash then processed in a smelter or refinery.
Nickel yields of more than 100 kilograms per hectare are possible with the right fertilisers and herbicides (the latter to kill off competing plants and something that would need to be carefully monitored from an environmental perspective you would imagine). Alan Baker, a leader in this study, is now based at the School of Botany, University of Melbourne.