Plot lines from two different matrices in R?

Asked

Viewed 30 times

1

I have two matrices with same number of rows and different number of columns. Each matrix is a sample, each row is a compound (1,2 and 3), and each column is the residue number. The value in the matrix are contact numbers that the binder x makes with the residue y. Well, I would like to compare the contact difference of compound 1 (2 and 3) between the samples. What I have is:


matrix1

structure(c(4L, 4L, 0L, 3L, 0L, 0L, 4L, 0L, 0L, 12L, 0L, 0L, 
4L, 8L, 0L, 5L, 0L, 6L, 3L, 0L, 3L, 7L, 1L, 8L, 6L, 14L, 6L, 
16L, 7L, 4L, 9L, 14L, 0L, 6L, 4L, 5L, 3L, 0L, 6L, 12L, 16L, 15L, 
0L, 1L, 0L, 0L, 2L, 0L, 0L, 15L, 1L, 0L, 16L, 0L, 0L, 0L, 1L, 
0L, 0L, 6L, 0L, 0L, 19L, 0L, 0L, 5L, 0L, 0L, 14L, 0L, 0L, 1L), .Dim = c(3L, 
24L), .Dimnames = list(c("1", "2", "3"), c("84", "120", "123", 
"124", "126", "142", "150", "151", "152", "155", "157", "167", 
"168", "170", "82", "51", "78", "158", "74", "75", "76", "77", 
"90", "153"))) 

matrix2  

structure(c(2L, 0L, 0L, 1L, 0L, 0L, 1L, 1L, 0L, 2L, 9L, 7L, 4L, 
0L, 0L, 3L, 0L, 0L, 3L, 0L, 0L, 5L, 8L, 0L, 3L, 0L, 0L, 6L, 8L, 
0L, 1L, 16L, 23L, 2L, 14L, 0L, 15L, 0L, 0L, 11L, 0L, 0L, 4L, 
4L, 0L, 0L, 3L, 0L, 0L, 3L, 15L, 0L, 7L, 13L, 0L, 0L, 6L, 0L, 
0L, 9L, 0L, 0L, 8L, 0L, 0L, 2L, 0L, 0L, 5L, 0L, 0L, 11L, 0L, 
0L, 6L, 0L, 0L, 5L, 0L, 0L, 2L), .Dim = c(3L, 27L), .Dimnames = list(
    c("1", "2", "3"), c("82", "84", "75", "76", "77", "132", 
    "133", "138", "153", "154", "155", "156", "157", "158", "164", 
    "53", "167", "170", "51", "85", "87", "88", "89", "90", "152", 
    "168", "169")))

I would like to plot bar graph BY LIGANT (i.e., line 1 of Matrix 1 and line 1 of Matrix 2). Here is an example for a binder, to look more or less like this (in the case below it is with three matrices, in my case there are two):

inserir a descrição da imagem aqui

I want to make three separate charts for each binder (1, 2 and 3). Could someone help me?

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.