plot - R - plotting specific columns as x with two rows as the lines -


here small sample of data:

    gene_name ctrl_lsm1_ratio_t0 ctrl_lsm1_ratio_t1 ctrl_lsm1_ratio_t2 22     abp140          -0.262682          -0.303352          -0.223626 246      ari1          -0.163952          -0.374765          -0.321876 454      bph1          -0.517519          -0.524553          -0.747609 513      bur6           0.645573           0.217433           0.390403 588     cdc20          -0.264072          -0.665268          -0.594191     ctrl_lsm1_ratio_t3 ctrl_lsm1_stat_t0 ctrl_lsm1_stat_t1 ctrl_lsm1_stat_t2 22           -0.421704                no                no                no 246          -0.692391                no                no                no 454          -0.793595                no                no               yes 513           0.200799               yes                no                no 588          -0.523884                no               yes               yes     ctrl_lsm1_stat_t3 systematic_name 22                yes         yor239w 246               yes         ygl157w 454               yes         ycr032w 513                no         yer159c 588               yes         ygl116w 

i plot columns [,2:5] on x axis (as in time point 0, 1, 2, , 3) y axis fitting ratio columns.

if there's way color points 1 color "yes" or "no" @ specific time points, able that. (for instance, points in ctrl_lsm1_ratio_t0 column colored based on values in ctrl_lsm1_stat_t0 column).

i want plot 2 rows @ time, both lines (for instance row 22 row 513). hope makes sense! i'm new r , not sure do. i'm willing download whatever package necessary.

data.csv:

    gene_name,ctrl_lsm1_ratio_t0,ctrl_lsm1_ratio_t1,ctrl_lsm1_ratio_t2,ctrl_lsm1_ratio_t3,ctrl_lsm1_stat_t0,ctrl_lsm1_stat_t1,ctrl_lsm1_stat_t2,ctrl_lsm1_stat_t3,systematic_name     abp140,-0.262682,-0.303352,-0.22362,-0.421704,no,no,no,yes,yor239w6     ari1,-0.163952,-0.374765,-0.32187,-0.692391,no,no,no,yes,ygl157w6     bph1,-0.517519,-0.524553,-0.74760,-0.793595,no,no,yes,yes,ycr032w9     bur6,0.645573,0.217433,0.39040,0.200799,yes,no,no,no,yer159c3     cdc20,-0.264072,-0.665268,-0.59419,-0.523884,no,yes,yes,yes,ygl116w1 

code:

    d<-read.csv("data.csv", header=t, stringsasfactors=f)     matplot(t(d[,2:5]), type="l", pch=20, lty=1, xlab="time", ylab="ctrl_lsm1_ratio")     d2<-reshape(d[,6:9],varying=list(names(d[,6:9])),direction="long",v.name="ctrl_lsm1_stat", ids=d$gene_name)     points(d2$time, unlist(d[,2:5]), col=ifelse(d2$ctrl_lsm1_stat=="yes",1,2),cex=2.0)     legend("topright",legend=c("yes","no"), col=c(1,2), pch=21) 

enter image description here


Comments

Popular posts from this blog

python - TypeError: start must be a integer -

c# - DevExpress RepositoryItemComboBox BackColor property ignored -

django - Creating multiple model instances in DRF3 -