Menu

cs4786-fa16

1KB R snippet created on September 7th 2016. This file is private.

Actions
# Scatter plot functions for assignment 1
# 
# Author: Patrick Nicholson
###############################################################################


scatter_plot_q1 <- function(Y,YY){
	
#	 For this script I assume that Y is the one dimensional projection before 
#	 renormalization and YY is the one dimensional projection after
#	 renormalization. This script will provide a visualization of the two
#	 projections to see how different they are. 
					
#	 First we scatter plot the points without normalization and visualize it
#	 by setting color for first fifty (left to right) as blue and next fifty
#	 as red.
	
	s = sort(Y, index.return = TRUE)
	plot(s$x[51:100],rep(0,50),col="red",main="Before normalization",xlim=c(0,100))
	points(s$x[1:50],rep(0,50),col="blue")
	
#	Now we plot the points after renormalization with the same color scheme.
	
	dev.new()
	plot(YY[s$ix[51:100]],rep(0,50),col="red",main="After normalization",xlim=c(0,100))
	points(YY[s$ix[1:50]],rep(0,50),col="blue")
	
	
}

scatter_plot_q2 <- function(Y){
	
#	Plot first 500 points in blue and next 500 in red (X axis is the 
#	projected data and Y axis I am using 0 to plot).
	
	plot(Y[1:500],rep(0,500),col="blue",xlim=c(0,1000))
	points(Y[501:1000],rep(0,500),col="red")
	
}

Loading
loading...
shift+enter to add a new line