Question 1

Plot.default {graphics} is a basic function used to draw simple scatter plots and line graphs. Plot.hexbin {hexbin} function is used to draw Scatter plots providing a legend indicating the count representations. Different with plot.default {graphics}, it can be used to draw high-density scatter plots, and the color depth of the hexagon represents the density of the scatter. In a word, this function distinguishes overlapping data points with hexagons of different color depths, making the scatter plot clear at a glance.

Question 2

The striking differences on the two types of plots is that the right one have colors and an extra legend.I prefer the right type of plots. In the left graphs, when the amount of data is large, it is difficult for us to find the structure of the data from the scatter plot. The right graphs combines the characteristics of scatter plots and histograms. Similar to the scatter plot, the right plots is also drawn on the x and y axes, and the third dimension is to use shading to describe the concentration of data. Thus although both graphs show the same data, we can easily see where the data is more densely gathered from the graphs on the right.

Task 1

data <- read.table("GSM4209275_10X_SCRNASEQ_WT_EA_AGGR.tsv.gz",header = TRUE)
nrow(data)
## [1] 8744
ncol(data)
## [1] 3531

Task 2

You can also embed plots, for example:

library (plyr)
## Warning: package 'plyr' was built under R version 4.0.2
u128up <- ldply (data["128up",], data.frame)[,2]
AIMP2 <- ldply (data["AIMP2",], data.frame)[,2]
AOX1 <- ldply (data["AOX1",], data.frame)[,2]
AP <- ldply (data["AP-1sigma",], data.frame)[,2]
u2mit <- ldply (data["2mit",], data.frame)[,2]
HT7 <- ldply (data["5-HT7",], data.frame)[,2]

plot(u128up,AIMP2,type = 'p',xlab = "128up",xlim = c(-10,30))

plot(u128up,AOX1,type = 'p',xlab = "128up",ylim = c(-6,8))

plot(u128up,AP,type = 'p',xlab = "128up",ylab = "AP-1sigma",xlim = c(-10,30))

plot(u2mit,AIMP2,type = 'p',xlab = "2mit",xlim = c(-10,20))

plot(u2mit,AOX1,type = 'p',xlab = "2mit",ylim = c(-1,3))

plot(u2mit,AP,type = 'p',xlab = "2mit",ylab = "AP-1sigma",xlim = c(-20,30))

plot(HT7,AIMP2,type = 'p',xlab = "5-HT7",xlim = c(-20,20))

plot(HT7,AOX1,type = 'p',xlab = "5-HT7",ylim = c(0,2))

plot(HT7,AP,type = 'p',xlab = "5-HT7",ylab = "AP-1sigma",xlim = c(-20,20))

Task 2

library(hexbin)
## Warning: package 'hexbin' was built under R version 4.0.2
library(RColorBrewer)
my_colors=colorRampPalette(rev(brewer.pal(11,'Spectral')))

x1 <- hexbin(u128up,AIMP2,xbins = 50,xbnds=c(-0.8,25.1),ybnds = c(-0.8,24))
plot(x1,style = "colorscale",xlab = "128up",type='p',
     colramp=my_colors,legend = 1, lcex = 0.4)

x2 <-  hexbin(u128up,AOX1,xbins = 50,xbnds=c(-0.8,25.1),
              ybnds = c(-0.08,2.1))
plot(x2,style = "colorscale",xlab = "128up",type='p',
     colramp=my_colors,legend = 1, lcex = 0.4)

x3 <-  hexbin(u128up,AP,xbins = 50,xbnds=c(-0.8,25.1),
              ybnds = c(-0.8,27))
plot(x3,style = "colorscale",xlab = "128up",ylab = "AP-1sigma",type='p',
     colramp=my_colors,legend = 1, lcex = 0.4)

x4 <-  hexbin(u2mit,AIMP2,xbins = 50,xbnds=c(-0.3,9.5),
              ybnds = c(-0.8,24))
plot(x4,style = "colorscale",xlab = "2mit",type='p',
     colramp=my_colors,legend = 1, lcex = 0.4)

x5 <-  hexbin(u2mit,AOX1,xbins = 50,xbnds=c(-0.3,9.5),
              ybnds = c(-0.1,2.1))
plot(x5,style = "colorscale",xlab = "2mit",type='p',
     colramp=my_colors,legend = 1, lcex = 0.4)

x6 <-  hexbin(u2mit,AP,xbins = 50,xbnds=c(-0.3,9.5),
              ybnds = c(-0.8,27))
plot(x6,style = "colorscale",xlab = "2mit",ylab = "AP-1sigma",type='p',
     colramp=my_colors,legend = 1, lcex = 0.4)

x7 <-  hexbin(HT7,AIMP2,xbins = 50,xbnds=c(-0.2,5.2),
              ybnds = c(-0.8,24))
plot(x7,style = "colorscale",xlab = "5-HT7",type='p',
     colramp=my_colors,legend = 1, lcex = 0.4)

x8 <-  hexbin(HT7,AOX1,xbins = 50,xbnds=c(-0.2,5.2),
              ybnds = c(-0.1,2.1))
plot(x8,style = "colorscale",xlab = "5-HT7",type='p',
     colramp=my_colors,legend = 1, lcex = 0.4)

x9 <-  hexbin(HT7,AP,xbins = 50,xbnds=c(-0.2,5.2),
              ybnds = c(-0.8,27))
plot(x9,style = "colorscale",xlab = "5-HT7",ylab = "AP-1sigma",type='p',
     colramp=my_colors,legend = 1, lcex = 0.4)