How do I add a bar of categorical colors to a plotly heatmap?

The plotly code in R:

a1 <- list(
  size=1
)
a <- list(
  title="BLAST Hit ID",
  tickangle="45",
  tickfont=a1
)
b <- list(
  title="Query ID",
  tickfont=a1
)
plot_ly(z=numericMatrix,
        y=rownames(numericMatrix),
        x=colnames(numericMatrix),
        type="heatmap") %>% layout(xaxis=a,yaxis=b)

I would like to have a bar that runs down the left side of the heatmap that contains different colors, such as in the following plot made with heatmap.2
https://friends.manas.ca/Rplot37.png
This was generated with:

par(lend=1, xpd=TRUE)
heatmap.2(numeric_results,
          Rowv=FALSE,
          Colv=FALSE,
          dendrogram="none",
          trace="none",
          margins=c(8,9),
          cexRow=0.5,
          cexCol=0.5,
          srtCol=45,
          RowSideColors = c(rep("gray", 8), rep("blue", 17), 
            rep("black", 16), rep("green", 3), 
            rep("purple", 31)))
legend(x=1.07, y=-0.07 ,
       legend=c("Bundibugyo", "Reston", "Sudan", "Tai Forest", "Zaire"),
       col=c("gray", "blue", "black", "green","purple"), lty = 1, lwd = 10, 
      bty="n", cex=0.5, seg.len=0.2, xjust=0)

Thanks.

(first asked here https://stackoverflow.com/questions/34449419/how-do-i-add-a-bar-of-categorical-colors-to-a-plotly-heatmap )

I would like to have a bar that runs down the left side of the heatmap that contains different colors

I’m not sure what you mean by this. What wold the colors represent in this case?

If you look at this image: https://friends.manas.ca/Rplot37.png you’ll see a vertical bar with the colors gray, blue, black, green & purple. The colors represent a different group of genomes, one for each species of the ebolavirus genus.

You could add a heatmap subplot to your graph with a custom colorscale mapping to gray, blue, black, green & purple as desired.