Transmission through arrays of gold particles - janeshdev/ggplot2 GitHub Wiki
Description of the data
This data was collected by measuring the white light transmitted through a sample containing small gold particles.
Because of their strong response to light (gold is shiny!) there is a dip in transmittance in the visible regime (wavelengths between 0.4 to 0.8 micrometres). This experiment was conducted for different arrangements of the particles on the sample (density, positions, surrounding medium air /water), and two different orientations of the particles with respect to the polarisation state of the incident light.
Challenge
The challenge was to display this wealth of information on a single page to draw conclusions between the different panels. In particular I wanted to show the following trends:
- the samples with higher density of particles (right panels) present a broader dip in transmission (more colours strongly interact with the particles).
- the shift of the dip in transmission when the surrounding medium is varied from air to water is fairly constant for all the panels (however such a shift is easier to observe and quantify for a well-defined curve).
- the position of the particles influences substantially the spectral lineshape. In particular, allowing neighbouring particles to touch (random) or not (“hard core”) has a strong influence on the spectral response of the sample.
- the orientation of the particles with respect to the polarisation of the incident light has also a strong influence on the measured spectra.
Improvements (TODO):
- use the type = ‘b’ trick to make the points easier to see
Code
df2002$density <- factor("200") df3002$density <- factor("300") str(df2002) # 'data.frame': 11040 obs. of 6 variables: # $ wavelength : num 404 405 406 406 407 ... # $ variable : Factor w/ 14 levels "spectrum1","spectrum2",..: 1 1 1 1 1 1 1 1 1 1 ... # $ value : num 0.946 0.943 0.944 0.939 0.938 ... # $ medium : Factor w/ 2 levels "air","water": 1 1 1 1 1 1 1 1 1 1 ... # $ orientation: Factor w/ 2 levels "ordered","random": 1 1 1 1 1 1 1 1 1 1 ... # $ position : Factor w/ 4 levels "hard core","jitter",..: 4 4 4 4 4 4 4 4 4 4 ... str(df3002) # 'data.frame': 11040 obs. of 6 variables: # $ wavelength : num 404 405 406 406 407 ... # $ variable : Factor w/ 14 levels "spectrum1","spectrum2",..: 1 1 1 1 1 1 1 1 1 1 ... # $ value : num 0.963 0.965 0.967 0.963 0.964 ... # $ medium : Factor w/ 2 levels "air","water": 1 1 1 1 1 1 1 1 1 1 ... # $ orientation: Factor w/ 2 levels "ordered","random": 1 1 1 1 1 1 1 1 1 1 ... # $ position : Factor w/ 4 levels "hard core","jitter",..: 4 4 4 4 4 4 4 4 4 4 ... both <- rbind(df3002, df2002)# merge the two data sets both$type <- with(both, factor(paste(orientation,position), labels=letters[1:6])) smallboth <- both[seq(1, nrow(both), by=50), ] # small subset to add shapes without overplotting p <- # lines plot ggplot(data = both, mapping = aes(x = wavelength*1e-3, y = value)) + facet_grid(type~density) + layer(mapping=aes(colour=orientation, linetype=medium), geom = c( "line"), stat = "identity" ) + scale_x_continuous(expression("wavelength / "*mu*m), limits=c(0.5, 0.9)) + scale_y_continuous("Transmittance", limits=c(0.85, 1), breaks=seq(0.85, 1, by=0.05)) + scale_colour_brewer("orientation", palette="Set1")+ theme_bw() p2 <- # adding shapes to differentiate between the geometrical arrangements p + layer(data=smallboth, mapping=aes(colour=orientation, shape=position), geom = c( "point"), size=0.8, stat = "identity" ) + scale_shape(solid = FALSE)
Affiliation:
Electromagnetic materials group, School of Physics
University of Exeter, UK
PLEASE NOTE: you may not use or copy the data or the graph displayed on this page without proper acknowledgments, as it is part of my PhD thesis.