A method of energy dispersive spectroscopy - EDS - analysis, the method comprising: - providing a first set of materials and associated material data, wherein each material data represent properties of the associated material; - directing an electron beam to a plurality of locations on a sample and recording an energy dispersive x-ray spectrum associated with each of the plurality of locations; - processing each location of the plurality of locations by: - assigning a material of the first set of materials to the processed location, if a first similarity criterion determined based on the energy dispersive x-ray spectrum associated with the processed location and the first set of material data is fulfilled; and then - determining a first group of locations which do not have any of the materials of the first set of materials assigned; and the method being characterised by - processing locations of the first group of locations by: - determining a second group of locations which have at least one material of the first set of materials assigned and which fulfil a first proximity criterion relative to the processed location; and - assigning the at least one material of the first set of materials to the processed location based on the materials assigned to the locations of the second group of locations. - providing a first set of materials and associated material data, wherein each material data represent properties of the associated material; - directing an electron beam to a plurality of locations on a sample and recording an energy dispersive x-ray spectrum associated with each of the plurality of locations; - processing each location of the plurality of locations by: - assigning a material of the first set of materials to the processed location, if a first similarity criterion determined based on the energy dispersive x-ray spectrum associated with the processed location and the first set of material data is fulfilled; and then - determining a first group of locations which do not have any of the materials of the first set of materials assigned; and the method being characterised by - assigning a material of the first set of materials to the processed location, if a first similarity criterion determined based on the energy dispersive x-ray spectrum associated with the processed location and the first set of material data is fulfilled; and then - determining a first group of locations which do not have any of the materials of the first set of materials assigned; and the method being characterised by - processing locations of the first group of locations by: - determining a second group of locations which have at least one material of the first set of materials assigned and which fulfil a first proximity criterion relative to the processed location; and - assigning the at least one material of the first set of materials to the processed location based on the materials assigned to the locations of the second group of locations. - determining a second group of locations which have at least one material of the first set of materials assigned and which fulfil a first proximity criterion relative to the processed location; and - assigning the at least one material of the first set of materials to the processed location based on the materials assigned to the locations of the second group of locations.