Skip to content

Instantly share code, notes, and snippets.

@ivan-krukov
Created December 9, 2013 20:00
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 ivan-krukov/7879772 to your computer and use it in GitHub Desktop.
Save ivan-krukov/7879772 to your computer and use it in GitHub Desktop.
Matrix plotting in R
#this is a simple way to plot a matrix from a txt file
mat_data_frame=read.table("data.txt",header=F)
#rev is there to start plotting M(0,0) in the upper left corner
#col=rainbow(10) uses the rainbow color palette. You can find other ones here:
#http://stat.ethz.ch/R-manual/R-devel/library/grDevices/html/palettes.html
image(as.matrix(rev(mat_data_frame)),col=rainbow(10))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment