Tuesday, January 18, 2011

R plotting tricks

# error bars, $Run is the group
library(sciplot)
bargraph.CI(DNase.625$Run, DNase.625$density, err.width=0.05)

# density plots
plot(density(DNase.625$density))

# multiple plots
par(mfrow=c(2,1))
bargraph.CI(DNase.625$Run, DNase.625$density, err.width=0.05)
hist(DNase.625$density)

# empty plot, n = no points
empty set of axes (use "type='n'"),

# saving images to file use png() or pdf()
png('avg_density.png', width=800, height=800)
plot(dens.avg.frame, type='b', lty=3)
dev.off()

No comments: