Good advice on graph choice, from human perceptual standpoint by Frank Harrell
In the lab we usually use the R package, ggplot2, for graphs. Ask Sarah about the ggplot2 book.
For custom colour schemes, the Chart of R Colors is a helpful resource. The table with named colours is most useful.
#where 'g' is your ggplot object str(g) #gives you everything! summary(g) #gives a summary options(g) #lists the options last_plot() #refreshes the last plot and returns the struct
p=p+scale_y_continuous(breaks=c(0,0.5,1),minor_breaks=c(.25,.75)) #changing axis breaks p=p+opts(title="one-behind errors") p=p+xlab('relative phase')
opts(panel.grid.minor = theme_blank())+
last_plot() + opts(panel.grid.minor = theme_line(colour = "black") )
facet_grid(.~subject) # rows~columns
g<-g+stat_summary(fun.y=mean,geom="point",position="jitter") #getting jitter to work when you're collapsing across other variables with stat_summary
g=g+ stat_smooth(method="glm",family="binomial",fullrange=TRUE) #adds logistic smoother to plot #it's impossible to extract the function fits however because they're fit on the fly #how can I fit an arbitrary function, like a psychometric function, e.g. cumulative gaussian with chance rate and lapse rate? Logistic is restricted to 0->1
order used for scale mapping (color, etc.) is perhaps the order of the levels property of the vector. This gives bizarre results because R's sort(unique(x)) default does not alphabetize strings. Getting things to appear in a graph or something the way you want may require reordering the 'levels' of a factor, like this to put DL as the last subject to be graphed:
See Chapter 8 of the ggplot book
p+ theme_bw() #changes all options to those of theme_bw theme_bw() #see associated list of options p + opts( axis.text.x= theme_text(size = base_size * 0.8 , lineheight = 0.9, colour = "grey50", hjust = 1, angle = 90) ) p+opts(legend.key=theme_rect(fill=NULL,colour="white"))
#remove shading of facet_grid labels and lines around them, for better post-production editing p+ opts(strip.background = theme_rect(colour = 'white', fill=NULL))
#turn off grid p+ opts(panel.grid.major=theme_blank(), panel.grid.minor=theme_blank())ok