Entering edit mode
5.6 years ago
Inquisitive8995
▴
280
Hello,
I have a tsv file with 1s and 0s. It has about 20 rows and 100 columns. I have created a dataframe. Now, I want to create a plot/graph which can show a particular colour/pattern for all 1s and another for the 0s with rownames in x-axis and column names along the y-axis. Is this possible in R ? I tried creating normal plots but this gives error saying "rows and columns are not equal".
Thanks in advance.
I am pressed for time, but you may consider a levelplot (from lattice package), as this example shows: Specifying colours for binary data using levelplot
Thanks for your reply. But this doesn't work for my pre-existing matrix
I do not know what 'doesn't work' means. Also, did you not consider that you may have to write some extra lines of code to adapt a pre-existing solution to your own data-set? In bioinformatics, there is never a 'one size fits all' solution'. You have to wrestle with and 'wrangle' your data. Punch it a few times. It neither helps that you have done neither of the following:
I have been trying different plot and methods with my data already. As mentioned, I have a binary file with 0s and 1s. I tried using this file as a dataframe and as a matrix.
When I used my file as a matrix, I used the below command w.r.t the link provided by you;
But it gave me an empty plot. Thanks once again for your reply.