1

I am having a data where the row.names are gene names and I have two columns and I would like to plot the gene names as in x axes and in one y axis I want the number of variants and in the other y axis the pathogencity score

My table is like this

       Variant numbers  Pathogencity scores
MED12   5                0.814
MYD88   2                0.96
SF3B1   5                0.871
JAK2    2                0.988
NF1     3                0.965
TNFAIP3 2                0.936
PHF6    3                0.928
ATRX    2                0.871

My row.names are genes. I would want to put a barplot with 2 y axis showing one the number of variants on the left and pathogenictiy score on the right. I was trying to find examples of plotrix(twoord.plot) but was unable to find. I can create the single plots but unable to put the second y axis.

Any help would be appreciated. Thanks

ivivek_ngs
  • 917
  • 3
  • 10
  • 28

1 Answers1

0

I already found an answer to my question. Thanks to the post here

The code is here below and it works perfect. Will have to rush with the colors but as of now it is fine. Here is the code below if someone would like to use for their benefits. Will have to exploit is farther for color usage. Thanks a lot

code:

a=c(2,2,2,2,3,3,5,5)
b=c(0.960,0.988,0.936,0.871,0.928,0.965,0.814,0.871)
 genes=c("MYD88","JAK2","TNFAIP3","ATRX","PHF6","NF1","MED12","SF3B1")
 genesnum<-1:8
 twoord.plot(genesnum,a, genesnum,b,type=c("bar","l"),ylab="Number of Variants",rylab="Pathogenicity scores",xlab="Mutant Genes",lcol=8,rcol=4,do.first="plot_bg()", xticklab= genes,lpch=1,halfwidth=0.2,axislab.cex=0.8)

IMAGE enter image description here

Community
  • 1
  • 1
ivivek_ngs
  • 917
  • 3
  • 10
  • 28