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.
Simplest way, using *image* plot:

    image(x, col = c("red", "blue"), main = "base image plot")

And for more flexibility, we can try *ggplot*:

    library(ggplot2)

    #convert wide to long format
    plotDat <- reshape::melt(x)

    #and plot
    ggplot(plotDat, aes(X1, X2, fill = c("red", "blue")[ value + 1 ])) +
      geom_tile() +
      scale_fill_identity() +
      theme_minimal() +
      ggtitle("ggplot geom_tile")

Example data

    set.seed(1); x <- matrix(sample(0:1, 25, replace = TRUE), nrow = 5)
    colnames(x) <- paste0("col", 1:5)
    rownames(x) <- paste0("row", 1:5)
    x
    #      col1 col2 col3 col4 col5
    # row1    0    1    0    0    1
    # row2    0    1    0    1    0
    # row3    1    1    1    1    1
    # row4    1    1    0    0    0
    # row5    0    0    1    1    0


