Skip to content

Instantly share code, notes, and snippets.

@SwampThingPaul
Created March 9, 2020 00:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SwampThingPaul/981c5ad78bb6297b167034c73a0bd9e4 to your computer and use it in GitHub Desktop.
Save SwampThingPaul/981c5ad78bb6297b167034c73a0bd9e4 to your computer and use it in GitHub Desktop.
## quick bar and line plot in base
data=data.frame(value=c(3,4,6,2),value2=c(10,12,20,9))
par(oma=c(3,2,0.5,3),mar=c(2,3,0.25,2))
barplot(data$value,ylim=c(0,12),las=2,space=c(0.5))
mtext(side=2,line=2,"Value")
par(new=T);x=barplot(data$value2,ylim=c(0,25),axes=F,col=NA,border=NA,space=c(0.5))
lines(x,data$value2,lwd=3)
axis(4,las=2)
mtext(side=4,line=2.5,"Value 2")
axis(1,x,1:4)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment