Guest User

Untitled

a guest
Jul 22nd, 2018
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. scatter_compare2 = function(
  2. df,
  3. col1, col2,
  4. pch = 3,
  5. legend = c(col1,col2),
  6. label_col = 0,
  7. xlab = col1, ylab = col2
  8. ) {
  9. xlim = c( get_lim(c(df[,col1],df[,col2])) )
  10. ylim = c( get_lim(c(df[,col1],df[,col2])) )
  11. plot(
  12. df[,col1], df[,col2],
  13. xlab = xlab, ylab = ylab,
  14. xlim = xlim, ylim = ylim
  15. )
  16.  
  17. abline( a = 0, b = 1 )
  18.  
  19. if ( label_col != 0 ) {
  20. library(plotrix)
  21. outliers = df[ abs( df[,col1] - df[,col2] ) > 15, ]
  22. thigmophobe.labels( outliers[,col1], outliers[,col2], outliers[,
  23. label_col], col = 1 )
  24. }
  25. }
Add Comment
Please, Sign In to add comment